[Haskell-cafe] Haskell modules: Morton's fork?
Rein Henrichs
rein.henrichs at gmail.com
Sat Jul 22 19:19:15 UTC 2017
A typeclass with the shared functions as members is an option. YMMV on
whether it is cleaner.
On Fri, Jul 21, 2017 at 1:56 PM Nikita Churaev <lamefun.x0r at gmail.com>
wrote:
> 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?
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170722/683bfcf3/attachment.html>
More information about the Haskell-Cafe
mailing list