[Haskell-cafe] Local types

Imants Cekusins imantc at gmail.com
Tue Jan 26 09:11:37 UTC 2016

> That wouldn't enable such definitions as mine earlier, where the
instance is defined in terms of other local terms.

agree - that wouldn't. However tweaks over instance export would allow
you to move a complex function to its own module where module-local
instances could be defined.

> this would be a breach of consistency of instances:
one could so define terms with instances in conflict [0].

could GHC (with appropriate changes) figure conflict out and throw error?

e.g. GHC could enforce that instances can only be hidden if they are
not referred to in any of exported types or functions in the instance
defining module?

.. it could cause error to import the same instance-defining module
(including imports by imports) with and without instances hidden.

.. mark instance (with a pragma?) as module-local

.. only most basic instances (which compile without pragmas) could be hidden

.. hide / export all or no instances (for a given class?) within a module

.. another safety net?

personally, I am happy with the current GHC as it is. Just wondering:
is function - the appropriate place to define types and instances.

More information about the Haskell-Cafe mailing list