eskimor / purescript-bridge

Create PureScript datatypes from Haskell datatypes
BSD 3-Clause "New" or "Revised" License
110 stars 49 forks source link

Data.Word i.e. GHC.Word is not supported #68

Closed marijanp closed 1 year ago

marijanp commented 1 year ago

When generating the purescript module for a type using Data.Word e.g.

import Data.Word (Word64)
data Foo = Foo {
  _bar :: Word64
}

The converted code results in

import GHC.Word
...
....

Expected code is:

import Data.UInt64
...
eskimor commented 1 year ago

Should be easy to fix, by adding a corresponding BridgePart here and adding it to the defaultBridge.

marijanp commented 1 year ago

@eskimor Do you have any opinions on what the respective PS type should be for Data.Word? There is purescript-word

eskimor commented 1 year ago

Not really, except that bringing in a package might not be good for such a simple type. The suggested Data.UInt64 should be a safe bet, in case there is nothing more appropriate.

marijanp commented 1 year ago

@eskimor I would like to stick with purescript-word it has tests and looks solid to me. I also talked to other purescript users, they agree and noted that an alternative would be to just use Number. But I'ld like to have the type safety.

marijanp commented 1 year ago

@eskimor I've created a PR, can I get a review?

eskimor commented 1 year ago

Yes - I actually started already, but got distracted by other things.