A typeclass with the shared functions as members is an option. YMMV on whether it is cleaner.
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.