Created
June 14, 2018 22:52
-
-
Save cartermp/27fde6de7f7cbd2d348e9c0f8e4dc12e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open FSharp.Data.UnitSystems.SI.UnitSymbols | |
type float<[<Measure>] 'm> with | |
member a.Bind(f,x) = f x * a | |
member a.Return(x) = a * sqrt x | |
member a.Yield(x) = a / x | |
member a.Combine(b:float<'m1>, c:float<'m2>) = a * b * c | |
member a.Quote(x) = System.Runtime.Hosting.ApplicationActivator() | |
member a.Delay(f) = f() * a | |
member a.Run(f) = Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation f | |
[<System.Runtime.CompilerServices.Extension>] | |
type A = | |
[<System.Runtime.CompilerServices.Extension>] | |
static member Yield(_:float<S>, b:float<Pa>) = b * 1.0<C> | |
// Mystery question: Where does the Celsius come from? | |
let x = | |
3.14<S> { | |
yield 2.71<Pa> | |
yield 2.71<S> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment