[Haskell-cafe] Stupid newbie question

Jason Creighton jcreigh at gmail.com
Fri Jan 5 21:13:51 EST 2007

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

...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

Jason Creighton

More information about the Haskell-Cafe mailing list