[Haskell-cafe] Stupid newbie question

Brian Hurt bhurt at spnz.org
Fri Jan 5 21:43:37 EST 2007

On Fri, 5 Jan 2007, Jason Creighton wrote:

> On Fri, Jan 05, 2007 at 08:17:33PM -0500, Brian Hurt wrote:
>> My apologies for wasting bandwidth on what I'm sure is a stupid newbie
>> question.
>> Given:
>> -- Reimplementing the wheel here, I know
>> data Option a = Some a | Empty
>> 	deriving (Eq,Ord,Show,Read)
> My apologies if you knew this already, (I don't know whether your
> "Reimplementing the wheel" comment refers to this type or the "nth"
> function) but this is the Maybe data type in Prelude:
> data Maybe a = Nothing | Just a

Both, actually.  I did the Option a definition to get some experience with 
defining symbolic data types, and probably should have removed it in my 

> ...which is the same as yours, except it's spelled differently, is an
> instance of several handy classes (eg, Monad), and has a handful of
> helper functions predefined: http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Maybe.html

Thanks for the link.


More information about the Haskell-Cafe mailing list