Hi Elmers,
How do I pattern match on aliased types? E.g lets assume I have the
following type definitions:
type alias View a m = m -> Html a -- view is a function which
turns a model (m) into html (Html a)
type alias ModelAndView a m = (m, View a m) -- a pair of a model and a
view
type PageDef a m = ModelAndView a m | Html a -- algebraic type for
unrealised html (model+view) and realised html
how do I pattern match on PageDef ?
viewChild : PageDef a m -> Html a
viewChild pageDef =
case pageDef of
ModelAndView a m as m_v ->
case m_v of
(m, v) -> v m -- !!! GOT AN ERROR HERE !!!
Html a as h -> h
Is it even possible to pattern match directly?
Regards,
Daniel
--
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.