agrafix / elm-bridge

Haskell: Derive Elm types from Haskell types
BSD 3-Clause "New" or "Revised" License
101 stars 27 forks source link

Support For Haskell Type Alias #25

Closed theNerd247 closed 6 years ago

theNerd247 commented 6 years ago
type A = String 
data Foo = Foo 
  { a :: A
  }

produces

type alias Foo = 
  { a :: A
  }

Which gives the error that the type A isn't defined. Is there support for recursively deriving types?

bartavelle commented 6 years ago

There is support for newtypes, but not for type aliases. I rarely use them, so I could get away with just declaring the type alias on the Elm side every time ...

bartavelle commented 6 years ago

(Given the way it works right now, "fixing" it would require deriving an elm definition for the type alias too.)

theNerd247 commented 6 years ago

Ok. I tried to use TypeSynonym instances as shortcut. Thanks for the try however it looks like the elm-export package has what I need. I can keep this open however for future users.

bartavelle commented 6 years ago

Not sure what my brain is made of some days. My last commit (from January the 11th) added support for newtypes, exactly what you needed :/ It is not on hackage yet though. Let me know if you still would like to use elm-bridge and I will produce a release.

bartavelle commented 6 years ago

I am working of having a more robust newtype support.