I have a data type data Foo a b = Bar a b
that I use internally in a library.
I also have an alias for one of its more common concrete forms: type
You can export Bar
type simply by module Quux (Bar) where ...
, though you will not be able to construct any Bar
s.
If you also need the constructor, you may use similar technique to smart constructors, that is create a helper functions which creates Bar
s and export that one:
module Quux (Bar, bar) where
data Foo a b = Foo a b
type Bar = Foo Int Int
bar :: Int -> Int -> Bar
bar = Foo
then
\> let b = bar 1 2
\> :type b
b :: Bar
\> let f = Foo 1 2
:9:9: Not in scope: data constructor ‘Foo’