[Haskell-cafe] Haddock: Documentation of instances with un-documentable type arguments

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Sat Sep 4 06:03:00 EDT 2010


On 4 September 2010 19:01, Alexander McPhail
<haskell.vivian.mcphail at gmail.com> wrote:
> Hi
>
> Is there a similar ticket for GHC to not export instances in the case that
> other instances are explicitly specified?
>
> module Foo (
>                    Foo(Monad)
>                   )
>
> instance Monad Foo where ...
> instance MonadState (Foo Bar) where ...
>
> i.e. the monad instance gets exported but the MonadState one does not?  This
> helps in maintaining opacity with respect to the package user.  I may not
> want the user to be able to call 'get' and 'put' when using my custom monad.

No: instances are implicitly imported and exported (if the class and
the type are visible, then so are any possible instances).

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list