File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -58,10 +58,10 @@ module ListT =
58
58
loop l1 l2 : ListT< 'mt>
59
59
60
60
let inline bind f ( source : ListT < 'mt >) : ListT < 'mu > =
61
- let _mnil _ = ( result Unchecked.defaultof< 't> : 'mt) >>= fun ( _ : 't ) -> ( result Unchecked.defaultof< 'u>) : 'mu
62
- let rec loop f ( ListT input) =
61
+ let _mnil = ( result Unchecked.defaultof< 't> : 'mt) >>= fun ( _ : 't ) -> ( result Unchecked.defaultof< 'u>) : 'mu
62
+ let rec loop f input =
63
63
ListT (
64
- ( unbox input : 'mit) >>= function
64
+ ( unwrap input : 'mit) >>= function
65
65
| Nil -> result <| ( Nil : ListTNode< 'mu, 'u>) : 'miu
66
66
| Cons ( h: 't, t: ListT< 'mt>) ->
67
67
let res = concat ( f h: ListT< 'mu>) ( loop f t)
Original file line number Diff line number Diff line change @@ -27,11 +27,11 @@ module BasicTests =
27
27
// Compile tests
28
28
let binds () =
29
29
let res1 = listT [| [ 1 .. 4 ] |] >>= fun x -> listT [| [ x * 2 ] |]
30
- let res2 = listT ( Task.FromResult [ 1 .. 4 ]) |> ListT.bind ( fun x -> listT ( Task.FromResult [ x * 2 ]))
31
- let res3 = listT ( ResizeArray [ [ 1 .. 4 ] ]) |> ListT.bind ( fun x -> listT ( ResizeArray [ [ x * 2 ] ]))
32
- let res4 = listT ( lazy [ 1 .. 4 ]) |> ListT.bind ( fun x -> listT ( lazy ( [ x * 2 ])))
33
- let ( res5 : ListT < _ seq >) = listT ( seq [ [ 1 .. 4 ] ]) |> ListT.bind ( fun x -> listT ( seq [ [ x * 2 ] ]))
34
- () // Note: seq needs type annotation, the non-sealead types don't work with generic >>= (internal error, unsolved type var)
30
+ let res2 = listT ( Task.FromResult [ 1 .. 4 ]) >>= ( fun x -> listT ( Task.FromResult [ x * 2 ]))
31
+ let res3 = listT ( ResizeArray [ [ 1 .. 4 ] ]) >>= ( fun x -> listT ( ResizeArray [ [ x * 2 ] ]))
32
+ let res4 = listT ( lazy [ 1 .. 4 ]) >>= ( fun x -> listT ( lazy ( [ x * 2 ])))
33
+ let ( res5 : ListT < _ seq >) = listT ( seq [ [ 1 .. 4 ] ]) >>= ( fun x -> listT ( seq [ [ x * 2 ] ]))
34
+ () // Note: seq needs type annotation.
35
35
36
36
let bind_for_ideantity () =
37
37
let res = listT ( Identity [ 1 .. 4 ]) >>= fun x -> listT ( Identity [ x * 2 ])
You can’t perform that action at this time.
0 commit comments