[Haskell-cafe] Prelude.head: empty list
Adam Bergmark
adam at bergmark.nl
Mon Mar 14 13:12:23 UTC 2016
Yes you can define your own Prelude. You can’t shadow modules but you can depend on a package providing a custom prelude while not explicitly depending on base.
On Mon 14 Mar 2016 at 14:01 Clinton Mead
<
mailto:Clinton Mead <clintonmead at gmail.com>
> wrote:
Just thinking out loud here, but could one write their own Prelude which just imports hiding (head), adds a new definition of head, and reexports the lot. Then add this new Prelude higher in the search path perhaps?
On Monday, 14 March 2016, Han Joosten <
mailto:han.joosten.han at gmail.com
> wrote:
Thanks all! Plenty good options, fortunately I found my bug pretty fast by simple code inspection :))
_______________________________________________
Haskell-Cafe mailing list
mailto:Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
2016-03-12 4:28 GMT+01:00 Chris Wong
<
javascript:_e(%7B%7D,'cvml','lambda.fairy at gmail.com');
>
:
On Sat, Mar 12, 2016 at 8:07 AM, Jonas Scholl
<
javascript:_e(%7B%7D,'cvml','anselm.scholl at tu-harburg.de');
> wrote:
> You mean like this?
>
> default-extensions: CPP
> cpp-options:
> -Dhead=(foldr(const)(error("head:\x20\x65mpty\x20list\x20in\x20"++__FILE__++":"++show(__LINE__))).(take$1))
That's pretty cool!
By the way: can the (take$1) be removed? foldr should be lazy enough already.
--
Chris Wong (
https://lambda.xyz
)
"I had not the vaguest idea what this meant and when I could not
remember the words, my tutor threw the book at my head, which did not
stimulate my intellect in any way." -- Bertrand Russell
_______________________________________________
Haskell-Cafe mailing list
javascript:_e(%7B%7D,'cvml','Haskell-Cafe at haskell.org'); http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160314/b682284f/attachment.html>
More information about the Haskell-Cafe
mailing list