On Mon, Jan 30, 2017 at 12:17 PM, Oliver Searle-Barnes <[email protected]>
wrote:

> # Building a Store without boilerplate
>

I don't think that's possible.
Elm is a static language and what you seam to want is dynamic behavior.

The practical way to solve this is to ferry type information and use that
type information to generate the dynamic behavior.
In Elm, this is done with the help of Json.Decode/Json.Encode

This way, you can take a concrete Elm type, convert it to a generic type
like Value or String, do something dynamic based on the info you encode in
this generic type, get a generic result back and convert the result back
into some concrete Elm type.
so you can have something like:

doSomethingDynamic : a -> (a -> Value) -> Decoder b -> b
doSomethingDynamic payload encoder decoder =
    ...

Have you seen how I have approached the issue in the exploration bellow?
https://github.com/pdamoc/elm-sapling


-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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.

Reply via email to