Haskell how to hide (exclude) a function from module without explicitly listing all the non hidden functions?

As far as I’m aware there is not currently a way to do this.

What I usually end up doing is having a central module that re-exports important things as a convenient way to import everything that is necessary while not hiding anything in the modules defining these things (which in some cases – that you probably won’t foresee! – makes it easier for your users to modify things in your module).

To do this use the following syntax:

-- |Convenient import module
module Foo.Import (module All) where

-- Import what you want to export
import Foo.Stuff as All hiding (local_func)
-- You can import several modules into the same namespace for this trick!
-- For example if using your module also requires 'decode' from "Data.Aeson" you can do
import Data.Aeson as All (decode)

You have now conveniently exported these things.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)