Personal tools

The Other Prelude

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
m (added links to other proposa pages, added page to Category:Proposals)
(Title conventions on hawiki pages)
Line 1: Line 1:
 
[[Category:Proposals]]
 
[[Category:Proposals]]
   
== Call for Contribution ==
+
== Call for contribution ==
 
This fun project, called "The Other Prelude", and is a creative reconstruction of the standard Prelude. By disregarding history and compatibility, we get a clean sheet.
 
This fun project, called "The Other Prelude", and is a creative reconstruction of the standard Prelude. By disregarding history and compatibility, we get a clean sheet.
   
== Naming Conventions ==
+
== Naming conventions ==
 
The principal is to make the names very readable for both beginners and category theorists (if any).
 
The principal is to make the names very readable for both beginners and category theorists (if any).
   
Line 15: Line 15:
   
   
== The Hierarchy ==
+
== The hierarchy ==
 
* <hask>TheOtherPrelude</hask> - Minimalistic module.
 
* <hask>TheOtherPrelude</hask> - Minimalistic module.
 
* <hask>TheOtherPrelude.Extension</hask> - Convenient definitions.
 
* <hask>TheOtherPrelude.Extension</hask> - Convenient definitions.
   
== The Code ==
+
== The code ==
 
Currently, the code is in Wiki form. If people do agree that the collaborative decisions begot something pretty, we'll have a group of files in darcs.haskell.org some time.
 
Currently, the code is in Wiki form. If people do agree that the collaborative decisions begot something pretty, we'll have a group of files in darcs.haskell.org some time.
   
Line 51: Line 51:
 
</haskell>
 
</haskell>
   
== See Also ==
+
== See also ==
 
* [[Mathematical prelude discussion]] - A numeric Prelude. Could this be merged into this one?
 
* [[Mathematical prelude discussion]] - A numeric Prelude. Could this be merged into this one?
 
* [[Prelude extensions]] and [[Prelude function suggestions]] - Unlike "The Other Prelude" they ''enhance'' the Prelude.
 
* [[Prelude extensions]] and [[Prelude function suggestions]] - Unlike "The Other Prelude" they ''enhance'' the Prelude.

Revision as of 14:08, 21 December 2006


Contents

1 Call for contribution

This fun project, called "The Other Prelude", and is a creative reconstruction of the standard Prelude. By disregarding history and compatibility, we get a clean sheet.

2 Naming conventions

The principal is to make the names very readable for both beginners and category theorists (if any).

3 Guidelines

  • The prelude should not contain any "projection" functions (like
    fst
    and
    snd
    . They go to the Extension module.


4 Issues

  • Should alphanumeric names be preferred over symbols when defining a class?


5 The hierarchy

  • TheOtherPrelude
    - Minimalistic module.
  • TheOtherPrelude.Extension
    - Convenient definitions.

6 The code

Currently, the code is in Wiki form. If people do agree that the collaborative decisions begot something pretty, we'll have a group of files in darcs.haskell.org some time.

The imaginery Prelude as it stands,

import Prelude ()    -- hide everything
 
-- the idea is to remove 'fmap' 
-- and map :: (a -> b) -> [a] -> [b] to be a special case
 
class Functor f where
  map :: (a -> b) -> f a -> f b
 
 
-- should the Functor hierarchy proposal be adopted?
class Monad m where
  (>>=) :: m a -> (a -> m b) -> m b
  (>>) :: m a -> m b -> m b
  return :: a -> m a
  fail :: String -> m a

How to use it, as it stands,

import Prelude ()                            -- hide everything
import TheOtherPrelude                       -- get everything
import qualified TheOtherPrelude.Monad as M  -- standard convention

7 See also