3 people like it.
Like the snippet!
Generic POCO generators for FsCheck
TypeShape-driven FsCheck random generator generator with support for arbitrary POCOs
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
|
open System
open TypeShape
open FsCheck
let rec mkGenerator<'T> () : Gen<'T> =
let wrap (t : Gen<'a>) = unbox<Gen<'T>> t
let mkRandomMember (shape : IShapeWriteMember<'DeclaringType>) =
shape.Accept { new IWriteMemberVisitor<'DeclaringType, Gen<'DeclaringType -> 'DeclaringType>> with
member __.Visit (shape : ShapeWriteMember<'DeclaringType, 'Field>) =
let rf = mkGenerator<'Field>()
gen { let! f = rf in return fun dt -> shape.Inject dt f } }
match TypeShape.Create<'T>() with
| Shape.Primitive -> wrap Arb.generate<'T>
| Shape.Unit -> wrap Arb.generate<unit>
| Shape.String -> wrap Arb.generate<string>
| Shape.Guid -> wrap Arb.generate<Guid>
| Shape.DateTime -> wrap Arb.generate<DateTime>
| Shape.FSharpOption s ->
s.Accept { new IFSharpOptionVisitor<Gen<'T>> with
member __.Visit<'t> () =
let tGen = mkGenerator<'t>()
Gen.frequency
[ (10, tGen |> Gen.map Some) ;
(1, gen { return None }) ]
|> wrap
}
| Shape.Array s when s.Rank = 1 ->
s.Accept { new IArrayVisitor<Gen<'T>> with
member __.Visit<'t> _ =
let tG = mkGenerator<'t>()
gen {
let! length = Gen.sized(fun n -> Gen.choose(-1, n))
match length with
| -1 -> return null
| _ ->
let array = Array.zeroCreate<'t> length
for i = 0 to array.Length - 1 do let! t = tG in array.[i] <- t
return array
} |> wrap
}
| Shape.FSharpList s ->
s.Accept { new IFSharpListVisitor<Gen<'T>> with
member __.Visit<'t> () =
let tG = mkGenerator<'t>()
gen {
let! length = Gen.sized(fun n -> Gen.choose(0, n))
let rec aux acc n = gen {
if n = 0 then return acc
else
let! t = tG
return! aux (t :: acc) (n - 1)
}
return! aux [] length
} |> wrap
}
| Shape.FSharpSet s ->
s.Accept { new IFSharpSetVisitor<Gen<'T>> with
member __.Visit<'t when 't : comparison> () =
let tG = mkGenerator<'t list>()
wrap(tG |> Gen.map Set.ofList)
}
| Shape.FSharpMap s ->
s.Accept {
new IFSharpMapVisitor<Gen<'T>> with
member __.Visit<'k, 'v when 'k : comparison> () =
let kvG = mkGenerator<('k * 'v) list>()
wrap(kvG |> Gen.map Map.ofList)
}
| Shape.Tuple s ->
s.Accept { new ITupleVisitor<Gen<'T>> with
member __.Visit (shape : ShapeTuple<'Tuple>) =
let eGens = shape.Elements |> Array.map mkRandomMember
gen {
let mutable target = shape.CreateUninitialized()
for eg in eGens do let! u = eg in target <- u target
return target
} |> wrap
}
| Shape.FSharpRecord s ->
s.Accept { new IFSharpRecordVisitor<Gen<'T>> with
member __.Visit (shape : ShapeFSharpRecord<'Record>) =
let fieldGen = shape.Fields |> Array.map mkRandomMember
gen {
let mutable target = shape.CreateUninitialized()
for eg in fieldGen do let! u = eg in target <- u target
return target
} |> wrap
}
| Shape.FSharpUnion s ->
s.Accept { new IFSharpUnionVisitor<Gen<'T>> with
member __.Visit (shape : ShapeFSharpUnion<'Union>) =
let caseFieldGen = shape.UnionCases |> Array.map (fun uc -> uc.Fields |> Array.map mkRandomMember)
gen {
let! tag = Gen.choose(0, caseFieldGen.Length - 1)
let mutable u = shape.UnionCases.[tag].CreateUninitialized()
for f in caseFieldGen.[tag] do let! uf = f in u <- uf u
return u
} |> wrap
}
| Shape.CliMutable s ->
s.Accept { new ICliMutableVisitor<Gen<'T>> with
member __.Visit (shape : ShapeCliMutable<'Class>) =
let propGen = shape.Properties |> Array.map mkRandomMember
gen {
let mutable target = shape.CreateUninitialized()
for ep in propGen do let! up = ep in target <- up target
return target
} |> wrap
}
| Shape.Poco s ->
s.Accept { new IPocoVisitor<Gen<'T>> with
member __.Visit (shape : ShapePoco<'Poco>) =
let bestCtor =
shape.Constructors
|> Seq.filter (fun c -> c.IsPublic)
|> Seq.sortBy (fun c -> c.Arity)
|> Seq.tryFind (fun _ -> true)
match bestCtor with
| None -> failwithf "Class %O lacking an appropriate ctor" typeof<'Poco>
| Some ctor ->
ctor.Accept { new IConstructorVisitor<'CtorParams, Gen<'T>> with
member __.Visit<'CtorParams> (ctor : ShapeConstructor<'Poco, 'CtorParams>) =
let paramGen = mkGenerator<'CtorParams>()
gen {
let! args = paramGen
return ctor.Invoke args
} |> wrap
}
}
| _ -> Arb.generate<'T> // fall back to FsCheck mechanism
|
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
|
type Person(name : string, age : int) =
member __.Name = name
member __.Age = age
type Customer() =
member val Person = null with get, set
member val DateJoined = DateTime.MinValue with get, set
//let gen = Arb.generate<Customer list> // not supported
let gen = mkGenerator<Customer list> ()
Gen.sample 10 10 gen
|
namespace System
module TypeShape
namespace FsCheck
val mkGenerator<'T> : unit -> obj
Full name: Script.mkGenerator
val wrap : ('a -> 'b)
val t : 'a
val unbox : value:obj -> 'T
Full name: Microsoft.FSharp.Core.Operators.unbox
val mkRandomMember : (IShapeWriteMember<'DeclaringType> -> 'a)
val shape : IShapeWriteMember<'DeclaringType>
type IShapeWriteMember<'Record> =
interface
inherit IShapeMember<'Record>
abstract member Accept : IWriteMemberVisitor<'Record,'R> -> 'R
end
Full name: TypeShape.IShapeWriteMember<_>
abstract member IShapeMember.Accept : IMemberVisitor<'DeclaringType,'R> -> 'R
abstract member IShapeWriteMember.Accept : IWriteMemberVisitor<'Record,'R> -> 'R
type IWriteMemberVisitor<'TRecord,'R> =
interface
abstract member Visit : ShapeWriteMember<'TRecord,'Field> -> 'R
end
Full name: TypeShape.IWriteMemberVisitor<_,_>
type ShapeWriteMember<'DeclaringType,'MemberType> =
interface IShapeWriteMember<'DeclaringType>
interface IShapeMember<'DeclaringType>
private new : label:string * memberInfo:MemberInfo * path:MemberInfo [] * readOnly:ShapeMember<'DeclaringType,'MemberType> -> ShapeWriteMember<'DeclaringType,'MemberType>
member Inject : instance:'DeclaringType -> field:'MemberType -> 'DeclaringType
member InjectExpr : instance:Expr<'DeclaringType> -> field:Expr<'MemberType> -> Expr<'DeclaringType>
member Project : instance:'DeclaringType -> 'MemberType
member ProjectExpr : instance:Expr<'DeclaringType> -> Expr<'MemberType>
member IsPublic : bool
member IsStructMember : bool
member Label : string
...
Full name: TypeShape.ShapeWriteMember<_,_>
Multiple items
module TypeShape
--------------------
type TypeShape =
private new : unit -> TypeShape
abstract member Accept : ITypeShapeVisitor<'R> -> 'R
abstract member ShapeInfo : TypeShapeInfo
abstract member Type : Type
override ToString : unit -> string
static member Create : unit -> TypeShape<'T>
static member Create : typ:Type -> TypeShape
Full name: TypeShape.TypeShape
--------------------
type TypeShape<'T> =
inherit TypeShape
new : unit -> TypeShape<'T>
override Accept : v:ITypeShapeVisitor<'a1> -> 'a1
override Equals : o:obj -> bool
override GetHashCode : unit -> int
override ShapeInfo : TypeShapeInfo
override Type : Type
Full name: TypeShape.TypeShape<_>
--------------------
new : unit -> TypeShape<'T>
static member TypeShape.Create : unit -> TypeShape<'T>
static member TypeShape.Create : typ:Type -> TypeShape
module Shape
from TypeShape
active recognizer Primitive: TypeShape -> unit option
Full name: TypeShape.Shape.( |Primitive|_| )
active recognizer Unit: TypeShape -> unit option
Full name: TypeShape.Shape.( |Unit|_| )
type unit = Unit
Full name: Microsoft.FSharp.Core.unit
active recognizer String: TypeShape -> unit option
Full name: TypeShape.Shape.( |String|_| )
Multiple items
val string : value:'T -> string
Full name: Microsoft.FSharp.Core.Operators.string
--------------------
type string = String
Full name: Microsoft.FSharp.Core.string
active recognizer Guid: TypeShape -> unit option
Full name: TypeShape.Shape.( |Guid|_| )
Multiple items
type Guid =
struct
new : b:byte[] -> Guid + 4 overloads
member CompareTo : value:obj -> int + 1 overload
member Equals : o:obj -> bool + 1 overload
member GetHashCode : unit -> int
member ToByteArray : unit -> byte[]
member ToString : unit -> string + 2 overloads
static val Empty : Guid
static member NewGuid : unit -> Guid
static member Parse : input:string -> Guid
static member ParseExact : input:string * format:string -> Guid
...
end
Full name: System.Guid
--------------------
Guid()
Guid(b: byte []) : unit
Guid(g: string) : unit
Guid(a: int, b: int16, c: int16, d: byte []) : unit
Guid(a: uint32, b: uint16, c: uint16, d: byte, e: byte, f: byte, g: byte, h: byte, i: byte, j: byte, k: byte) : unit
Guid(a: int, b: int16, c: int16, d: byte, e: byte, f: byte, g: byte, h: byte, i: byte, j: byte, k: byte) : unit
active recognizer DateTime: TypeShape -> unit option
Full name: TypeShape.Shape.( |DateTime|_| )
Multiple items
type DateTime =
struct
new : ticks:int64 -> DateTime + 10 overloads
member Add : value:TimeSpan -> DateTime
member AddDays : value:float -> DateTime
member AddHours : value:float -> DateTime
member AddMilliseconds : value:float -> DateTime
member AddMinutes : value:float -> DateTime
member AddMonths : months:int -> DateTime
member AddSeconds : value:float -> DateTime
member AddTicks : value:int64 -> DateTime
member AddYears : value:int -> DateTime
...
end
Full name: System.DateTime
--------------------
DateTime()
(+0 other overloads)
DateTime(ticks: int64) : unit
(+0 other overloads)
DateTime(ticks: int64, kind: DateTimeKind) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int, calendar: Globalization.Calendar) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, kind: DateTimeKind) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, calendar: Globalization.Calendar) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int, kind: DateTimeKind) : unit
(+0 other overloads)
active recognizer FSharpOption: TypeShape -> IShapeFSharpOption option
Full name: TypeShape.Shape.( |FSharpOption|_| )
val s : IShapeFSharpOption
abstract member IShapeFSharpOption.Accept : IFSharpOptionVisitor<'R> -> 'R
type IFSharpOptionVisitor<'R> =
interface
abstract member Visit : unit -> 'R
end
Full name: TypeShape.IFSharpOptionVisitor<_>
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
active recognizer Array: TypeShape -> IShapeArray option
Full name: TypeShape.Shape.( |Array|_| )
val s : IShapeArray
property IShapeArray.Rank: int
abstract member IShapeArray.Accept : IArrayVisitor<'R> -> 'R
type IArrayVisitor<'R> =
interface
abstract member Visit : rank:int -> 'R
end
Full name: TypeShape.IArrayVisitor<_>
type 'T array = 'T []
Full name: Microsoft.FSharp.Core.array<_>
Multiple items
union case TypeShapeInfo.Array: element: Type * rank: int -> TypeShapeInfo
--------------------
type Array =
member Clone : unit -> obj
member CopyTo : array:Array * index:int -> unit + 1 overload
member GetEnumerator : unit -> IEnumerator
member GetLength : dimension:int -> int
member GetLongLength : dimension:int -> int64
member GetLowerBound : dimension:int -> int
member GetUpperBound : dimension:int -> int
member GetValue : [<ParamArray>] indices:int[] -> obj + 7 overloads
member Initialize : unit -> unit
member IsFixedSize : bool
...
Full name: System.Array
val zeroCreate : count:int -> 'T []
Full name: Microsoft.FSharp.Collections.Array.zeroCreate
active recognizer FSharpList: TypeShape -> IShapeFSharpList option
Full name: TypeShape.Shape.( |FSharpList|_| )
val s : IShapeFSharpList
abstract member IShapeFSharpList.Accept : IFSharpListVisitor<'R> -> 'R
type IFSharpListVisitor<'R> =
interface
abstract member Visit : unit -> 'R
end
Full name: TypeShape.IFSharpListVisitor<_>
active recognizer FSharpSet: TypeShape -> IShapeFSharpSet option
Full name: TypeShape.Shape.( |FSharpSet|_| )
val s : IShapeFSharpSet
abstract member IShapeFSharpSet.Accept : IFSharpSetVisitor<'R> -> 'R
type IFSharpSetVisitor<'R> =
interface
abstract member Visit : unit -> 'R
end
Full name: TypeShape.IFSharpSetVisitor<_>
type 'T list = List<'T>
Full name: Microsoft.FSharp.Collections.list<_>
Multiple items
module Set
from Microsoft.FSharp.Collections
--------------------
type Set<'T (requires comparison)> =
interface IComparable
interface IEnumerable
interface IEnumerable<'T>
interface ICollection<'T>
new : elements:seq<'T> -> Set<'T>
member Add : value:'T -> Set<'T>
member Contains : value:'T -> bool
override Equals : obj -> bool
member IsProperSubsetOf : otherSet:Set<'T> -> bool
member IsProperSupersetOf : otherSet:Set<'T> -> bool
...
Full name: Microsoft.FSharp.Collections.Set<_>
--------------------
new : elements:seq<'T> -> Set<'T>
val ofList : elements:'T list -> Set<'T> (requires comparison)
Full name: Microsoft.FSharp.Collections.Set.ofList
active recognizer FSharpMap: TypeShape -> IShapeFSharpMap option
Full name: TypeShape.Shape.( |FSharpMap|_| )
val s : IShapeFSharpMap
abstract member IShapeFSharpMap.Accept : IFSharpMapVisitor<'R> -> 'R
type IFSharpMapVisitor<'R> =
interface
abstract member Visit : unit -> 'R
end
Full name: TypeShape.IFSharpMapVisitor<_>
Multiple items
module Map
from Microsoft.FSharp.Collections
--------------------
type Map<'Key,'Value (requires comparison)> =
interface IEnumerable
interface IComparable
interface IEnumerable<KeyValuePair<'Key,'Value>>
interface ICollection<KeyValuePair<'Key,'Value>>
interface IDictionary<'Key,'Value>
new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
member Add : key:'Key * value:'Value -> Map<'Key,'Value>
member ContainsKey : key:'Key -> bool
override Equals : obj -> bool
member Remove : key:'Key -> Map<'Key,'Value>
...
Full name: Microsoft.FSharp.Collections.Map<_,_>
--------------------
new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
val ofList : elements:('Key * 'T) list -> Map<'Key,'T> (requires comparison)
Full name: Microsoft.FSharp.Collections.Map.ofList
active recognizer Tuple: TypeShape -> IShapeTuple option
Full name: TypeShape.Shape.( |Tuple|_| )
val s : IShapeTuple
abstract member IShapeTuple.Accept : ITupleVisitor<'R> -> 'R
type ITupleVisitor<'R> =
interface
abstract member Visit : ShapeTuple<'Tuple> -> 'R
end
Full name: TypeShape.ITupleVisitor<_>
type ShapeTuple<'Tuple> =
interface IShapeTuple
private new : unit -> ShapeTuple<'Tuple>
member CreateUninitialized : unit -> 'Tuple
member CreateUninitializedExpr : unit -> Expr<'Tuple>
member Elements : IShapeWriteMember<'Tuple> []
Full name: TypeShape.ShapeTuple<_>
Multiple items
type Tuple =
static member Create<'T1> : item1:'T1 -> Tuple<'T1> + 7 overloads
Full name: System.Tuple
--------------------
type Tuple<'T1> =
new : item1:'T1 -> Tuple<'T1>
member Equals : obj:obj -> bool
member GetHashCode : unit -> int
member Item1 : 'T1
member ToString : unit -> string
Full name: System.Tuple<_>
--------------------
type Tuple<'T1,'T2> =
new : item1:'T1 * item2:'T2 -> Tuple<'T1, 'T2>
member Equals : obj:obj -> bool
member GetHashCode : unit -> int
member Item1 : 'T1
member Item2 : 'T2
member ToString : unit -> string
Full name: System.Tuple<_,_>
--------------------
type Tuple<'T1,'T2,'T3> =
new : item1:'T1 * item2:'T2 * item3:'T3 -> Tuple<'T1, 'T2, 'T3>
member Equals : obj:obj -> bool
member GetHashCode : unit -> int
member Item1 : 'T1
member Item2 : 'T2
member Item3 : 'T3
member ToString : unit -> string
Full name: System.Tuple<_,_,_>
--------------------
type Tuple<'T1,'T2,'T3,'T4> =
new : item1:'T1 * item2:'T2 * item3:'T3 * item4:'T4 -> Tuple<'T1, 'T2, 'T3, 'T4>
member Equals : obj:obj -> bool
member GetHashCode : unit -> int
member Item1 : 'T1
member Item2 : 'T2
member Item3 : 'T3
member Item4 : 'T4
member ToString : unit -> string
Full name: System.Tuple<_,_,_,_>
--------------------
type Tuple<'T1,'T2,'T3,'T4,'T5> =
new : item1:'T1 * item2:'T2 * item3:'T3 * item4:'T4 * item5:'T5 -> Tuple<'T1, 'T2, 'T3, 'T4, 'T5>
member Equals : obj:obj -> bool
member GetHashCode : unit -> int
member Item1 : 'T1
member Item2 : 'T2
member Item3 : 'T3
member Item4 : 'T4
member Item5 : 'T5
member ToString : unit -> string
Full name: System.Tuple<_,_,_,_,_>
--------------------
type Tuple<'T1,'T2,'T3,'T4,'T5,'T6> =
new : item1:'T1 * item2:'T2 * item3:'T3 * item4:'T4 * item5:'T5 * item6:'T6 -> Tuple<'T1, 'T2, 'T3, 'T4, 'T5, 'T6>
member Equals : obj:obj -> bool
member GetHashCode : unit -> int
member Item1 : 'T1
member Item2 : 'T2
member Item3 : 'T3
member Item4 : 'T4
member Item5 : 'T5
member Item6 : 'T6
member ToString : unit -> string
Full name: System.Tuple<_,_,_,_,_,_>
--------------------
type Tuple<'T1,'T2,'T3,'T4,'T5,'T6,'T7> =
new : item1:'T1 * item2:'T2 * item3:'T3 * item4:'T4 * item5:'T5 * item6:'T6 * item7:'T7 -> Tuple<'T1, 'T2, 'T3, 'T4, 'T5, 'T6, 'T7>
member Equals : obj:obj -> bool
member GetHashCode : unit -> int
member Item1 : 'T1
member Item2 : 'T2
member Item3 : 'T3
member Item4 : 'T4
member Item5 : 'T5
member Item6 : 'T6
member Item7 : 'T7
...
Full name: System.Tuple<_,_,_,_,_,_,_>
--------------------
type Tuple<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'TRest> =
new : item1:'T1 * item2:'T2 * item3:'T3 * item4:'T4 * item5:'T5 * item6:'T6 * item7:'T7 * rest:'TRest -> Tuple<'T1, 'T2, 'T3, 'T4, 'T5, 'T6, 'T7, 'TRest>
member Equals : obj:obj -> bool
member GetHashCode : unit -> int
member Item1 : 'T1
member Item2 : 'T2
member Item3 : 'T3
member Item4 : 'T4
member Item5 : 'T5
member Item6 : 'T6
member Item7 : 'T7
...
Full name: System.Tuple<_,_,_,_,_,_,_,_>
--------------------
Tuple(item1: 'T1) : unit
--------------------
Tuple(item1: 'T1, item2: 'T2) : unit
--------------------
Tuple(item1: 'T1, item2: 'T2, item3: 'T3) : unit
--------------------
Tuple(item1: 'T1, item2: 'T2, item3: 'T3, item4: 'T4) : unit
--------------------
Tuple(item1: 'T1, item2: 'T2, item3: 'T3, item4: 'T4, item5: 'T5) : unit
--------------------
Tuple(item1: 'T1, item2: 'T2, item3: 'T3, item4: 'T4, item5: 'T5, item6: 'T6) : unit
--------------------
Tuple(item1: 'T1, item2: 'T2, item3: 'T3, item4: 'T4, item5: 'T5, item6: 'T6, item7: 'T7) : unit
--------------------
Tuple(item1: 'T1, item2: 'T2, item3: 'T3, item4: 'T4, item5: 'T5, item6: 'T6, item7: 'T7, rest: 'TRest) : unit
val map : mapping:('T -> 'U) -> array:'T [] -> 'U []
Full name: Microsoft.FSharp.Collections.Array.map
active recognizer FSharpRecord: TypeShape -> IShapeFSharpRecord option
Full name: TypeShape.Shape.( |FSharpRecord|_| )
val s : IShapeFSharpRecord
abstract member IShapeFSharpRecord.Accept : IFSharpRecordVisitor<'R> -> 'R
type IFSharpRecordVisitor<'R> =
interface
abstract member Visit : ShapeFSharpRecord<'Record> -> 'R
end
Full name: TypeShape.IFSharpRecordVisitor<_>
type ShapeFSharpRecord<'Record> =
interface IShapeFSharpRecord
private new : unit -> ShapeFSharpRecord<'Record>
member CreateUninitialized : unit -> 'Record
member CreateUninitializedExpr : unit -> Expr<'Record>
member Fields : IShapeWriteMember<'Record> []
Full name: TypeShape.ShapeFSharpRecord<_>
active recognizer FSharpUnion: TypeShape -> IShapeFSharpUnion option
Full name: TypeShape.Shape.( |FSharpUnion|_| )
val s : IShapeFSharpUnion
abstract member IShapeFSharpUnion.Accept : IFSharpUnionVisitor<'R> -> 'R
type IFSharpUnionVisitor<'R> =
interface
abstract member Visit : ShapeFSharpUnion<'U> -> 'R
end
Full name: TypeShape.IFSharpUnionVisitor<_>
type ShapeFSharpUnion<'U> =
interface IShapeFSharpUnion
private new : unit -> ShapeFSharpUnion<'U>
member GetTag : caseName:string -> int
member GetTag : union:'U -> int
member GetTagExpr : union:Expr<'U> -> Expr<int>
member UnionCases : ShapeFSharpUnionCase<'U> []
Full name: TypeShape.ShapeFSharpUnion<_>
active recognizer CliMutable: TypeShape -> IShapeCliMutable option
Full name: TypeShape.Shape.( |CliMutable|_| )
val s : IShapeCliMutable
abstract member IShapeCliMutable.Accept : ICliMutableVisitor<'R> -> 'R
type ICliMutableVisitor<'R> =
interface
abstract member Visit : ShapeCliMutable<'Record> -> 'R
end
Full name: TypeShape.ICliMutableVisitor<_>
type ShapeCliMutable<'Record> =
interface IShapeCliMutable
private new : defaultCtor:ConstructorInfo -> ShapeCliMutable<'Record>
member CreateUninitialized : unit -> 'Record
member CreateUninitializedExpr : unit -> Expr<'Record>
member Properties : IShapeWriteMember<'Record> []
Full name: TypeShape.ShapeCliMutable<_>
Multiple items
type ClassAttribute =
inherit Attribute
new : unit -> ClassAttribute
Full name: Microsoft.FSharp.Core.ClassAttribute
--------------------
new : unit -> ClassAttribute
active recognizer Poco: TypeShape -> IShapePoco option
Full name: TypeShape.Shape.( |Poco|_| )
val s : IShapePoco
abstract member IShapePoco.Accept : IPocoVisitor<'R> -> 'R
type IPocoVisitor<'R> =
interface
abstract member Visit : ShapePoco<'Poco> -> 'R
end
Full name: TypeShape.IPocoVisitor<_>
type ShapePoco<'Poco> =
interface IShapePoco
private new : unit -> ShapePoco<'Poco>
member CreateUninitialized : unit -> 'Poco
member CreateUninitializedExpr : unit -> Expr<'Poco>
member Constructors : IShapeConstructor<'Poco> []
member Fields : IShapeWriteMember<'Poco> []
member IsStruct : bool
member Properties : IShapeMember<'Poco> []
Full name: TypeShape.ShapePoco<_>
module Seq
from Microsoft.FSharp.Collections
val filter : predicate:('T -> bool) -> source:seq<'T> -> seq<'T>
Full name: Microsoft.FSharp.Collections.Seq.filter
val sortBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> (requires comparison)
Full name: Microsoft.FSharp.Collections.Seq.sortBy
val tryFind : predicate:('T -> bool) -> source:seq<'T> -> 'T option
Full name: Microsoft.FSharp.Collections.Seq.tryFind
val failwithf : format:Printf.StringFormat<'T,'Result> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.failwithf
val typeof<'T> : Type
Full name: Microsoft.FSharp.Core.Operators.typeof
type IConstructorVisitor<'CtorType,'R> =
interface
abstract member Visit : ShapeConstructor<'CtorType,'CtorArgs> -> 'R
end
Full name: TypeShape.IConstructorVisitor<_,_>
type ShapeConstructor<'DeclaringType,'CtorArgs> =
interface IShapeConstructor<'DeclaringType>
private new : ctorInfo:ConstructorInfo * arity:int -> ShapeConstructor<'DeclaringType,'CtorArgs>
member Invoke : args:'CtorArgs -> 'DeclaringType
member InvokeExpr : args:Expr<'CtorArgs> -> Expr<'DeclaringType>
Full name: TypeShape.ShapeConstructor<_,_>
Multiple items
type Person =
new : name:string * age:int -> Person
member Age : int
member Name : string
Full name: Script.Person
--------------------
new : name:string * age:int -> Person
val name : string
val age : int
Multiple items
val int : value:'T -> int (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.int
--------------------
type int = int32
Full name: Microsoft.FSharp.Core.int
--------------------
type int<'Measure> = int
Full name: Microsoft.FSharp.Core.int<_>
member Person.Name : string
Full name: Script.Person.Name
val __ : Person
member Person.Age : int
Full name: Script.Person.Age
Multiple items
type Customer =
new : unit -> Customer
member DateJoined : DateTime
member Person : obj
member DateJoined : DateTime with set
member Person : obj with set
Full name: Script.Customer
--------------------
new : unit -> Customer
val set : elements:seq<'T> -> Set<'T> (requires comparison)
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.set
field DateTime.MinValue
val gen : obj
Full name: Script.gen
More information