[Haskell-cafe] modules as implicit data structures

Petr Pudlák petr.mvd at gmail.com
Thu Sep 6 09:42:49 UTC 2018


Hi Cafe,

Let's say we have a module like

module Foo where

foo, bar :: String -> Something
...

and use it elsewhere as

import qualified Foo as F
...
F.foo ...

This is almost just if we had a data type defined as

data FooModule = FooModule { foo :: String -> Something, bar :: String ->
Something }

together with a singleton `f : :FooModule` and referenced it as f.foo,
f.bar etc.

Has some language explored this idea of making modules explicit as
language-level objects? It seems that there could be some interesting
possibilities, such as:

- Abstract modules (just a definition of the data type). Then
- Being able to replace a module with a different one (like a fake one for
testing).
- Polymorphic modules that could be instantiated for specific types.

Thanks,
Petr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180906/03ade59e/attachment.html>


More information about the Haskell-Cafe mailing list