I honestly don't know if your code "should" typecheck or not, but if it
did, it wouldn't do anything more than what you already have. The function
you pass would only have access to the rect field. I think this code would
be simpler, and no less expressive, if the function argument was Rectangle
-> a. The fact that it's wrapped with some arbitrary fields is mixing
concerns.
I anyone using extensible records much?
I don't think people are using extensible record type aliases much. The { a
| fieldICareAbout : Int } -> Thing pattern is useful, though. (For example,
to call a view helper with the whole model but guarantee that it can't look
at certain fields.)
Nesting these field definitions makes the code a lot less readable then
just listing the records exactly. Try to make your type definitions more
explicit, and use your functions signatures to abstract away some of the
details.
State.mapPosition : (Rectangle -> a) -> State -> Maybe a
State.updatePosition : (Rectangle -> Rectangle) -> State -> State
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.