mdgriffith / elm-style-animation

The style animation library for Elm!
http://package.elm-lang.org/packages/mdgriffith/elm-style-animation/latest
BSD 3-Clause "New" or "Revised" License
440 stars 40 forks source link

I can't break out styles into composable functions #23

Closed wgottschalk-RMS closed 8 years ago

wgottschalk-RMS commented 8 years ago

instead of {style = Animation.style [ Animation.left (px 0.0) ]} I want to break but styles into helper functions. I need to do this in order to dynamically style each element so I set up a function like this:

layoutStyles : ElementId -> Animation a
layoutStyles id =
    Animation.style [ Animation.left (0 * id |> px) ]

initModel id =
    {style = layoutStyles id}

but I get the following error:

Cannot find type `Animation`

25| layoutStyles : Maybe Int -> Animation a
                               ^^^^^^^^^

And when I try Animation.State I get a type mismatch. Because Elm infers that it's looking for Animation.Model.Animation a and I have no way of getting to that type as far as I know.

mdgriffith commented 8 years ago

Hello!

Animation a is an internal type . Your type signature should be ElementId -> Animation.State or ElementId -> Animation.Messenger.State Msg if you're using the messaging feature.