# Hask

### From HaskellWiki

(Difference between revisions)

(Functor) |
(+seq issue) |
||

Line 4: | Line 4: | ||

* [http://www.cs.gunma-u.ac.jp/~hamana/Papers/cpo.pdf Makoto Hamana: ''What is the category for Haskell?''] | * [http://www.cs.gunma-u.ac.jp/~hamana/Papers/cpo.pdf Makoto Hamana: ''What is the category for Haskell?''] | ||

+ | |||

+ | == The seq problem == | ||

+ | |||

+ | The right identity law fails in '''Hask''' if we distinguish values which can be distinguished by <hask>seq</hask>, since: | ||

+ | |||

+ | <hask>id . undefined = \x -> id (undefined x) = \x -> undefined x</hask> | ||

+ | |||

+ | should be equal to <hask>undefined</hask>, but can be distinguished from it using <hask>seq</hask>: | ||

+ | |||

+ | ghci> (undefined :: Int -> Int) `seq` () | ||

+ | * Exception: Prelude.undefined | ||

+ | ghci> (id . undefined :: Int -> Int) `seq` () | ||

+ | () | ||

+ | |||

{{stub}} | {{stub}} | ||

[[Category:Mathematics]] | [[Category:Mathematics]] |

## Revision as of 01:10, 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 by

seq

id . undefined = \x -> id (undefined x) = \x -> undefined x

undefined

seq

ghci> (undefined :: Int -> Int) `seq` () * Exception: Prelude.undefined ghci> (id . undefined :: Int -> Int) `seq` () ()

*This article is a stub. You can help by expanding it.*