Things I figured out about Haskell today
Jul. 30th, 2009 11:07 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
- Maybe is the same thing as Kleene ? (the "zero or one" operator in regular expressions).
- A typeclass is the same thing as an STL concept, but a typeclass actually means it.
- instance means "We're going to make this data type an instance of this typeclass, and here's how."
? is not Maybe
Date: 2009-08-08 08:43 pm (UTC)Nope. The types are significantly different. Kleene ? operates on sets of sequences; Maybe is a constructor for a discriminated union:
extension(T?) = extension(T) union {[]}.
extension(Maybe T) = {Some t | t in extension(T)} union {Nothing}.
This is not just nitpicking, honestly :-)
(You seem to have typeclasses right.)