How can I export the constructors of my data family instances? I've tried various ways without success (see commented out code):
module Test (
--Foo () (..)
--type Foo () (..)
--UnitBar
) where
class Foo a where
data Bar a :: *
instance Foo () where
data Bar () = UnitBar
The only way I've been able to successfuly export the constructor is when doing a
module Test where
Notice the absense of parentheses. The drawback of this approach is that too much information leaves!
Use
module Test (
Bar(..)
) where
to export all constructors from the associated data family Bar
. Or
module Test (
Bar(UnitBar)
) where
to only export the single constructor.
You can read the relevant section in GHC's documentation for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With