Created
April 4, 2019 14:59
-
-
Save kevmal/eb79a2c8e4a0f59aeadcd063d1585069 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
let makeExpr x = | |
let rec func (m : Expression) ps = | |
match m with | |
| :? MethodCallExpression as x -> | |
let lambda = x.Arguments.[0] :?> LambdaExpression | |
func lambda.Body (lambda.Parameters.[0] :: ps) | |
| _ -> Expression.Lambda(m, ps |> List.rev) | |
func (FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.QuotationToExpression(x)) [] :?> Expression<_> | |
let (|F0|) (f : Expr<unit -> 'a>) : Expression<Func<'a>> = makeExpr f | |
let (|F1|) (f : Expr<'a -> 'b>) : Expression<Func<'a,'b>> = makeExpr f | |
let (|F2|) (f : Expr<'a -> 'b -> 'c>) : Expression<Func<'a,'b,'c>> = makeExpr f | |
let (|F3|) (f : Expr<'a -> 'b -> 'c -> 'd>) : Expression<Func<'a,'b,'c,'d>> = makeExpr f | |
let (|F4|) (f : Expr<'a -> 'b -> 'c -> 'd -> 'e>) : Expression<Func<'a,'b,'c,'d,'e>> = makeExpr f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment