[Haskell-cafe] modules as implicit data structures

Tom Ellis tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Thu Sep 6 10:24:18 UTC 2018


On Thu, Sep 06, 2018 at 11:42:49AM +0200, Petr Pudlák wrote:
> 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 }

Related reading

    http://www.haskellforall.com/2012/07/first-class-modules-without-defaults.html


More information about the Haskell-Cafe mailing list