Hask
From HaskellWiki
(Difference between revisions)
(+seq issue) |
(→The seq problem) |
||
| Line 13: | Line 13: | ||
should be equal to <hask>undefined</hask>, but can be distinguished from it using <hask>seq</hask>: | should be equal to <hask>undefined</hask>, but can be distinguished from it using <hask>seq</hask>: | ||
| - | ghci> (undefined :: Int -> Int) `seq` () | + | ghci> <hask>(undefined :: Int -> Int) `seq` ()</hask> |
* Exception: Prelude.undefined | * Exception: Prelude.undefined | ||
| - | ghci> (id . undefined :: Int -> Int) `seq` () | + | ghci> <hask>(id . undefined :: Int -> Int) `seq` ()</hask> |
() | () | ||
Revision as of 01:11, 3 October 2009
Hask is the name usually given to the category having Haskell types as objects and Haskell functions between them as morphisms.
A type-constructor that is an instance of the Functor class is an endofunctor on Hask.
The seq problem
The right identity law fails in Hask if we distinguish values which can be distinguished byseq
id . undefined = \x -> id (undefined x) = \x -> undefined x
undefined
seq
(undefined :: Int -> Int) `seq` ()
* Exception: Prelude.undefinedghci>
(id . undefined :: Int -> Int) `seq` ()
()
This article is a stub. You can help by expanding it.
