Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algebraic Data Types #1

Open
HuwCampbell opened this issue Jun 11, 2018 · 0 comments
Open

Algebraic Data Types #1

HuwCampbell opened this issue Jun 11, 2018 · 0 comments

Comments

@HuwCampbell
Copy link
Collaborator

HuwCampbell commented Jun 11, 2018

Currently we support a few special case ADTs. It would be nice to declare them in the Prelude and allow others to add their own. Just like in Haskell, we would need to wire some back in for things like box and reification.

Fortunately though, we because we don't offer recursion, we can restrict our types to simple products and sums.

From http://dev.stephendiehl.com/fun/009_datatypes.html

data Unit = Unit                 -- 1
data Empty                       -- 0
data (a * b) = Product a b       -- a * b
data (a + b) = Inl a | Inr b     -- a + b
-- We don't need these in Icicle
-- data Exp a b = Exp (a -> b)      -- a^b
-- data Rec f   = Rec (f (Rec f))   -- \mu

should do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant