-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
To try the project out, I tried recreating the Maybe.map2 function. The following is my generator code:
map2 : Declaration
map2 =
Elm.declaration "map2" <|
Elm.fn3
( "fn", Nothing )
( "maybeA", Nothing )
( "maybeB", Nothing )
(\fn maybeA maybeB ->
Elm.Case.maybe maybeA
{ nothing = Elm.nothing
, just =
( "a"
, \a ->
Elm.Case.maybe maybeB
{ nothing = Elm.nothing
, just =
( "b"
, \b -> Elm.just (Elm.apply fn [ a, b ])
)
}
)
}
)And this is the result:
map2 : (a -> b -> fn) -> maybeA -> maybeB -> Maybe fn
map2 fn maybeA maybeB =
case maybeA of
Nothing ->
Nothing
Just a_1_0 ->
case maybeB of
Nothing ->
Nothing
Just b_2_1_0 ->
Just (fn a_1_0 b_2_1_0)The problem is that the type signature should have been
map2 : (a -> b -> c) -> Maybe a -> Maybe b -> Maybe cMetadata
Metadata
Assignees
Labels
No labels