[Haskell-cafe] modules as implicit data structures

Steven Leiva leiva.steven at gmail.com
Thu Sep 6 11:51:14 UTC 2018


In Elixir/Erlang, module references are just atoms. (
https://elixir-lang.org/getting-started/basic-types.html#atoms)

You could bind a name to one module and then rebind it to another module.

On Thu, Sep 6, 2018 at 5:24 AM Tom Ellis <
tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk> wrote:

> 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
> _______________________________________________
> 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.



-- 
Steven Leiva
305.528.6038
leiva.steven at gmail.com
http://www.linkedin.com/in/stevenleiva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180906/568cf417/attachment.html>


More information about the Haskell-Cafe mailing list