# Towards a prevalent alternative prelude?

**URL:** <https://discourse.haskell.org/t/towards-a-prevalent-alternative-prelude/1986>\
**Category:** Haskell Foundation\
**Created:** [March 5, 2021, 9:10pm UTC](https://discourse.haskell.org/t/towards-a-prevalent-alternative-prelude/1986 "2021-03-05T21:10:53Z")\
**Posts on this page:** 1\
**Showing post:** 85

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [June 24, 2022, 2:02pm UTC](https://discourse.haskell.org/t/towards-a-prevalent-alternative-prelude/1986/85 "2022-06-24T14:02:39Z")

</div>

> [@tonyday567](#):
>
> Calcification of […] `head :: [a] -> a` into standards is against any principled approach.

[Deprecate partial functions from the Prelude, giving them new quarantined homes · Issue #70 · haskell/core-libraries-committee · GitHub](https://github.com/haskell/core-libraries-committee/issues/70) :

* * *

[andreasabel](https://github.com/haskell/core-libraries-committee/issues/70#issuecomment-1141814201):

> [@](#):
>
> I think a systematic fix of the problem should introduce a `Stream` type into base where `head`, `tail` etc. can be total. […]

- [Undecidability of equality for codata types](https://core.ac.uk/download/155777210.pdf)

- 

```haskell
init' :: a -> Stream a -> Stream a -- these would
last' :: a -> Stream a -> a -- be partial

```

* * *

[Gabriella439](https://github.com/haskell/core-libraries-committee/issues/70#issuecomment-1142238870):

> [@](#):
>
> […]if the Prelude did not already have these partial functions, I’m fairly confident the committee would not accept adding such partial functions […]

- [Nitpicks - HaskellWiki](https://wiki.haskell.org/Nitpicks)

* * *

[Gabriella439](https://github.com/haskell/core-libraries-committee/issues/70#issuecomment-1144995128):

> [@](#):
>
> […] for the new total replacements. I can see two main options, but maybe there are more:

- 

```haskell
head :: a -> [a] -> a
head d [] = d
head _ (x:xs) = x

tail :: a -> [a] -> a
tail d [] = d
tail _ (_:xs) = xs

init :: a -> [a] -> [a]
init d [] = d
init _ [_] = []
init d (x:xs) = xs : init d xs

last :: a -> [a] -> [a]
last d [] = d
last _ [x] = x
last _ (_:xs) = last d xs

```

* * *

[soupi](https://github.com/haskell/core-libraries-committee/issues/70#issuecomment-1146368889):

> [@](#):
>
> […] I’m tired of having to mentor juniors around these issues […]

- 

```haskell
module Tutorial_Prelude where
import Prelude hiding (
    head, tail, init, last, ...
)

```

> [@](#):
>
> […] production code _should not use partial functions_ because they make the code _crash_.

- [Lecture 25: Rice’s theorem](https://courses.engr.illinois.edu/cs373/sp2013/Lectures/lec25.pdf)

* * *

[emilypi](https://github.com/haskell/core-libraries-committee/issues/70#issuecomment-1159318304):

> [@](#):
>
> Very much in favor of this, even if the cure comes close to being as bad as the poison for prod systems.

- [R/haskell - Was simplified subsumption worth it for industry Haskell](http://discourse.haskell.org/t/r-haskell-was-simplified-subsumption-worth-it-for-industry-haskell/4486)

> [@](#):
>
> […] I’m fine with being paternal. It helps protect both people learning the language, as well as seasoned veterans […]

- [Elementary strong functional programming](https://core.ac.uk/download/10627495.pdf)

- [Total Functional Programming](https://www.jucs.org/jucs_10_7/total_functional_programming/jucs_10_07_0751_0768_turner.pdf)

- [Practical programming with total functions](https://core.ac.uk/download/232137083.pdf)

- [Denotative - HaskellWiki](https://wiki.haskell.org/Denotative)

- [https://dhall-lang.org](https://dhall-lang.org)

- [https://www.ioccc.org/2019/lynn/hint.html](https://www.ioccc.org/2019/lynn/hint.html)

* * *

---

_[View the full topic](https://discourse.haskell.org/t/towards-a-prevalent-alternative-prelude/1986)._
