[Haskell-beginners] How to process a list that contains "undefined" values?

David Place d at vidplace.com
Sat Jul 2 17:25:51 CEST 2011


On Jul 2, 2011, at 11:04 AM, Brandon Allbery wrote:

> The type tells you this right out, by the way:
> 
>> undefined :: a
> 
> What can you do with a "value" that can be any conceivable type, and
> about which nothing else can be said?  It has no handles, no behavior;
> the only possible interpretation is that it's not a value at all.


Its type makes undefined valuable in creating polymorphic functions.  You can see many examples of it in my article for the Monad.Reader:
"How to refold a map."  

> http://www.haskell.org/wikiupload/6/6a/TMR-Issue11.pdf

"undefined" is rendered by the symbol for "bottom" in the formatted code.

____________________
David Place   
Owner, Panpipes Ho! LLC
http://panpipesho.com
d at vidplace.com






More information about the Beginners mailing list