UInt hidden constructors warning
Closed this issue · 6 comments
jamesdbrock commented
Warning:
in module Data.UInt
at src/Data/UInt.purs:5:1 - 316:42 (line 5, column 1 - line 316, column 42)
An export for UInt hides data constructors but the type declares an instance of Data.Generic.Rep.Generic.
Such instance allows to match and construct values of this type, effectively making the constructors public.
See https://github.com/purescript/documentation/blob/master/errors/HiddenConstructors.md for more information,
or to contribute content related to this warning.
Actually UInt has no constructors at all.
foreign import data UInt :: TypeWe definitely want the Generic instance. So I'm not sure what to do about this. I'd like to get rid of this warning somehow.
jamesdbrock commented
jamesdbrock commented
jamesdbrock commented
Maybe instead of
foreign import data UInt :: Typethe definition for UInt should be
newtype UInt = UInt Int
derive instance newtypeUInt :: NewType UInt _Would that be equivalent? Then we could export the constructor.
jamesdbrock commented
Here's a commit with an exported constructor newtype UInt = UInt Number which solves the problem of hidden constructor with Generic instance.
I don't love this and I'm open to suggestions.
jamesdbrock commented
I would approach this by doing
newtype UInt = UInt Numberand not providing Generic
jamesdbrock commented
Done in v6.0.1