BAM Weblog

Roy - Recursive Data

Brian McKenna — 2011-12-04

Last week I blogged that this wasn’t possible in Roy:

data List a = Cons a (List a) | Nil

My one goal for this week was to make that possible. I managed to succeed and you can now even write fancier things like this:

data Tree a = TEmpty | TBranch a (Tree a) (Tree a)

console.log (TBranch 100 TEmpty (TBranch 100 TEmpty TEmpty))

// Won't compile:
// console.log (TBranch 100 TEmpty (TBranch "ASDF" TEmpty TEmpty))

I also fixed some simple problems with multiple declarations of things.

A very cool contribution has been a Roy TextMate/Sublime bundle:

Other awesome contributions have been:

Please enable JavaScript to view the comments powered by Disqus.