[Haskell-cafe] introspection -- towards type algebra

Rustom Mody rustompmody at gmail.com
Fri Apr 1 03:12:02 UTC 2016


I am looking for how far algebra on types in the manner of "set theory as
an algebra" ¹ is possible.


So for example in set theory one can compute for sets S, T
S∪T,  S∩T,  S-T etc

Is something similar possible for types?

Say I have
data Primary = Red|Green|Blue
data Othercolors = Violet|Indigo|Yellow|Orange

I want something like
Rainbow = Primary ∪ Othercolors

Equivalently if Rainbow and Primary had been defined, how to get/compute
Rainbow - Primary?
-------------------------
I thought the first-class types in Idris would be a good bet to try out at
least a trivial prototype.
Seems not...
So asking here.
Clearly and obviously one can use haskell to implement any language.
My question is what/which are the introspective libraries/features of
modern haskell that make this easy and lightweight.

Thanks
Rusi

¹ Yeah the term 'type algebra' may be taken in the sense of algebraic data
types
  Cant think of a better one
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160401/ff427417/attachment.html>


More information about the Haskell-Cafe mailing list