Skip to content

Instantly share code, notes, and snippets.

@DougBurke
Created February 23, 2015 22:39
Show Gist options
  • Save DougBurke/c61cfaba15a97fdc6f10 to your computer and use it in GitHub Desktop.
Save DougBurke/c61cfaba15a97fdc6f10 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"language": "haskell",
"name": "",
"signature": "sha256:b767382b75fdfbfda5140fb6033c141304b5b103f2384f7169e9daa68c21acce"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
":set -XTypeFamilies\n",
":set -XDataKinds"
],
"language": "python",
"metadata": {
"hidden": false
},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import Data.Metrology\n",
"import Data.Metrology.SI\n",
"import Data.Metrology.Show"
],
"language": "python",
"metadata": {
"hidden": false
},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"data AngleDim = AngleDim\n",
"data Radian = Radian\n",
"\n",
"instance Dimension AngleDim where\n",
" type DimFactorsOf AngleDim = '[]\n",
"\n",
"type instance DefaultUnitOfDim AngleDim = Radian\n",
"\n",
"instance Unit Radian where\n",
" type BaseUnit Radian = Canonical\n",
" type DimOfUnit Radian = AngleDim\n",
" type UnitFactorsOf Radian = '[]"
],
"language": "python",
"metadata": {
"hidden": false
},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"0.3 % Radian"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"text": [
"0.3"
]
}
],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"instance Show Radian where\n",
" show _ = \"rad\""
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"0.3 % Radian"
],
"language": "python",
"metadata": {
"hidden": false
},
"outputs": [
{
"html": [
"<span class='err-msg'>Could not deduce (Unit Radian) arising from a use of \u2018%\u2019<br/>from the context (Fractional n) bound by the inferred type of it :: Fractional n => Qu '[] 'DefaultLCSU n at <interactive>:1:1-12<br/>In the expression: 0.3 % Radian<br/>In an equation for \u2018it\u2019: it = 0.3 % Radian</span>"
],
"metadata": {},
"output_type": "display_data",
"text": [
"Could not deduce (Unit Radian) arising from a use of \u2018%\u2019\n",
"from the context (Fractional n) bound by the inferred type of it :: Fractional n => Qu '[] 'DefaultLCSU n at <interactive>:1:1-12\n",
"In the expression: 0.3 % Radian\n",
"In an equation for \u2018it\u2019: it = 0.3 % Radian"
]
}
],
"prompt_number": 6
}
],
"metadata": {}
}
]
}
@DougBurke
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment