[Haskell-cafe] Haskell modules: Morton's fork?

Nikita Churaev lamefun.x0r at gmail.com
Fri Jul 21 20:54:22 UTC 2017


Option 1:

    module App.Component (Foo, Bar, Qux) -- re-exports
    module App.Component.Foo (Foo, make, func1, func2)
    module App.Component.Bar (Bar, make, func1, func2)
    module App.Component.Qux (Qux, make, func1, func2)

API clients will have to write long import lists:

    import App.Component
    import qualified App.Component.Foo as Foo
    import qualified App.Component.Bar as Bar
    import qualified App.Component.Qux as Qux


Option 2:

    module App.Component (module Foo, module Bar) -- re-exports
    module App.Component.Foo (Foo, makeFoo, fooFunc1, fooFunc2)
    module App.Component.Bar (Bar, makeBar, barFunc1, barFunc2)
    module App.Component.Qux (Qux, makeQux, quxFunc1, quxFunc2)

Now you can import easily:

    import App.Component

But now you have to prefix your functions, just like in C...

Is there another, cleaner option?


More information about the Haskell-Cafe mailing list