Hask
From HaskellWiki
(Difference between revisions)
(→The seq problem) |
|||
| 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?''] | ||
| + | |||
| + | A solution approach to the issue of partiality making many of the identities required by categorical constructions not literally true in Haskell: | ||
| + | |||
| + | * [http://www.cs.nott.ac.uk/~nad/publications/danielsson-popl2006-tr.pdf Nils A. Danielsson, John Hughes, Patrik Jansson, and Jeremy Gibbons. ''Fast and loose reasoning is morally correct.''] | ||
| + | |||
| + | |||
== The seq problem == | == The seq problem == | ||
| Line 17: | Line 23: | ||
ghci> <hask>(id . undefined :: Int -> Int) `seq` ()</hask> | ghci> <hask>(id . undefined :: Int -> Int) `seq` ()</hask> | ||
() | () | ||
| - | |||
{{stub}} | {{stub}} | ||
[[Category:Mathematics]] | [[Category:Mathematics]] | ||
Revision as of 04:29, 13 November 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.
A solution approach to the issue of partiality making many of the identities required by categorical constructions not literally true in Haskell:
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.
