Any system to import a subset of modules into haskell?

With Perl exporting a standard module, you can specify function sets for export / import by tag.

So, you can have settings like :allor :privateor :testor something else.

The advice seems to be that if you just want some semi-private functions to have an “internal” module and re-export its parts by default.

I'm starting to want a semi-private interface for testing purposes. So is this another way to do this, or am I missing something in recent ghc?

+4
source share
3 answers

No, this is not possible in Haskell.

Haskell , . .

module Foo.Private
  ( private1
  , private2
  , private3
  ) where

...

module Foo
  ( public1
  , public2
  , public3
  ) where

...

, Foo.Private Foo:

module Foo.Private
  ( module Foo
  , private1
  , private2
  , private3
  ) where

import Foo

...

Foo Foo.Private, , Foo.Base, Foo Foo.Private.

, perl, ghc file , .

+4

, :

import Data.List (nub, sort)

nub sort Data.List. , -, :

import Data.List hiding (sort)

Data.List, .

, :

module Data.List
    ( sort,
      nub
    ) where

sort nub .

+2

the haskell version of the doctest version runs the code so that non-exported functions are in scope.

0
source

All Articles