# For all the haskell fans out there:

**URL:** <https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083>\
**Category:** The BBQ Pit\
**Created:** [November 19, 2014, 4:41pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083 "2014-11-19T16:41:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Budget\_Player\_Cadet](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/budget_player_cadet/32/205_2.png) [@Budget\_Player\_Cadet](https://boards.straightdope.com/u/Budget_Player_Cadet)\
**Post date:** [November 19, 2014, 4:41pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/1 "2014-11-19T16:41:48Z")

</div>

let f = (.).(.)

One of the tasks for my homework in Informatics 2, which is basically Haskell lab, is to evaluate this statement, and figure out what the function declaration for it is. In other words, f::x-\>y-\>z-\>…

Okay. Seriously, what the fuck? First of all, this sort of evaluation is not something that ever needs to be done by hand. If you’re in an environment where you can compile haskell, you’re in an environment where you can open up GHCi, type the following code:

let f = (.).(.)  
:t f

…and the compiler will give you exactly the precise declaration for the function. So it’s a complete waste of time to try to do this by hand. But more importantly, who the fuck writes a function like this? What, are they afraid of running out of pixels if they write it out? Like, here’s another one.

g = (.) map

…Or, in non-fucking-stupid-o-vision:

g function1 function2 list = map (function1 list).function2

Which, while still a fucking mess, is at least _somewhat_ understandable. I couldn’t even fucking tell you what this would look like for the function above. This is a complete and utter waste of everyone’s time .

---

<div class="post-metadata">

**Author:** ![andros](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@andros](https://boards.straightdope.com/u/andros)\
**Post date:** [November 19, 2014, 4:50pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/2 "2014-11-19T16:50:26Z")

</div>

I’m a little disappointed in your egregious begging of the question in your OP.

You seem to be under the misapprehension that there exist _fans_ of Haskell.

😃

---

<div class="post-metadata">

**Author:** ![Budget\_Player\_Cadet](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/budget_player_cadet/32/205_2.png) [@Budget\_Player\_Cadet](https://boards.straightdope.com/u/Budget_Player_Cadet)\
**Post date:** [November 19, 2014, 4:55pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/3 "2014-11-19T16:55:42Z")

</div>

Yeah, seriously. Fuck this language.

---

<div class="post-metadata">

**Author:** ![Capt.Ridley\_s\_Shooting\_Party](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Capt.Ridley\_s\_Shooting\_Party](https://boards.straightdope.com/u/Capt.Ridley_s_Shooting_Party)\
**Post date:** [November 19, 2014, 4:59pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/4 "2014-11-19T16:59:39Z")

</div>

They’re asking whether you understand type inference.

---

<div class="post-metadata">

**Author:** ![Mithras](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@Mithras](https://boards.straightdope.com/u/Mithras)\
**Post date:** [November 19, 2014, 6:50pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/5 "2014-11-19T18:50:20Z")

</div>

I haven’t read the bible in a while and am a little fuzzy on the details. Did God create GHCi on the eighth day after resting on the seventh or did he hand it down to Moses along with the ten commandments?

---

<div class="post-metadata">

**Author:** ![hotflungwok](https://avatars.discourse-cdn.com/v4/letter/h/edb3f5/32.png) [@hotflungwok](https://boards.straightdope.com/u/hotflungwok)\
**Post date:** [November 19, 2014, 7:03pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/6 "2014-11-19T19:03:23Z")

</div>

Okay, I know what the two . inside the () are, but what’s the . in the middle? Is that like a necklace or something?

---

<div class="post-metadata">

**Author:** ![tomndebb](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@tomndebb](https://boards.straightdope.com/u/tomndebb)\
**Post date:** [November 19, 2014, 7:03pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/7 "2014-11-19T19:03:52Z")

</div>

Haskell: Gee, Mrs. Cleaver, that sure is a nice dress.

That Haskell?

---

<div class="post-metadata">

**Author:** ![Eonwe](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/eonwe/32/240_2.png) [@Eonwe](https://boards.straightdope.com/u/Eonwe)\
**Post date:** [November 19, 2014, 7:06pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/8 "2014-11-19T19:06:55Z")

</div>

Your coding looks like boobies.

---

<div class="post-metadata">

**Author:** ![Doug\_K](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Doug\_K](https://boards.straightdope.com/u/Doug_K)\
**Post date:** [November 19, 2014, 7:18pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/9 "2014-11-19T19:18:35Z")

</div>

> [@Eonwe](#):
>
> Your coding looks like boobies.

But they hang down around the belly button.

---

<div class="post-metadata">

**Author:** ![hotflungwok](https://avatars.discourse-cdn.com/v4/letter/h/edb3f5/32.png) [@hotflungwok](https://boards.straightdope.com/u/hotflungwok)\
**Post date:** [November 19, 2014, 8:29pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/10 "2014-11-19T20:29:55Z")

</div>

Oh, it’s a belly button. ☹

---

<div class="post-metadata">

**Author:** ![leahcim](https://avatars.discourse-cdn.com/v4/letter/l/b4bc9f/32.png) [@leahcim](https://boards.straightdope.com/u/leahcim)\
**Post date:** [November 19, 2014, 9:09pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/11 "2014-11-19T21:09:03Z")

</div>

At the risk of attempting a non-boob-related answer (I know some Haskell, but not a lot, and certainly not enough):

“.” composes two functions, so I’d expect its signature to be something like (a -\> b) -\> (b -\> c) -\> (a -\> c)

The notation seems to want to compose two composes, so I’d think something like (a -\> b) -\> (b -\> c) -\> (c -\> d) -\> (d -\> e) -\> (a -\> e) or something.

I seem to recall that **Jragon** actually knows Haskell, so he might come in with a better answer.

Edited to add: Couldn’t you use Haskell’s infix notation to write the same thing as “(.)(.)(.)” (aka Total-Recall-notation)?

---

<div class="post-metadata">

**Author:** ![Eonwe](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/eonwe/32/240_2.png) [@Eonwe](https://boards.straightdope.com/u/Eonwe)\
**Post date:** [November 19, 2014, 9:21pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/12 "2014-11-19T21:21:52Z")

</div>

> [@leahcim](#):
>
> Edited to add: Couldn’t you use Haskell’s infix notation to write the same thing as “(.)(.)(.)” (aka Total-Recall-notation)?

😛

---

<div class="post-metadata">

**Author:** ![Find\_Friends](https://avatars.discourse-cdn.com/v4/letter/f/c37758/32.png) [@Find\_Friends](https://boards.straightdope.com/u/Find_Friends)\
**Post date:** [November 19, 2014, 9:29pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/13 "2014-11-19T21:29:48Z")

</div>

“Gee, Eddy, I didn’t know you could type… I thought all you knew how to do was be a jerk to guys!”

Eddy Haskel: :dubious: :mad:

---

<div class="post-metadata">

**Author:** ![eschereal](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/eschereal/32/18939_2.png) [@eschereal](https://boards.straightdope.com/u/eschereal)\
**Post date:** [November 19, 2014, 9:44pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/14 "2014-11-19T21:44:27Z")

</div>

I think the point of this exercise is that people sometimes write garbage source, so you need to be able to recognize it. Like, if I was teaching some form of C, I would reveal on the last day that _there exist these foul **goto** things and jump labels: and some assholes use them but you, my students never, ever should, just be aware that this garbage exists, so that you are not flummoxed when you see it_.

---

<div class="post-metadata">

**Author:** ![andros](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@andros](https://boards.straightdope.com/u/andros)\
**Post date:** [November 19, 2014, 10:04pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/15 "2014-11-19T22:04:42Z")

</div>

> [@eschereal](#):
>
> I think the point of this exercise is that people sometimes write garbage source, so you need to be able to recognize it. Like, if I was teaching some form of C, I would reveal on the last day that _there exist these foul **goto** things and jump labels: and some assholes use them but you, my students never, ever should, just be aware that this garbage exists, so that you are not flummoxed when you see it_.

When I was first learning OO (C++ in like 1993 or so), I had a final exam that consisted of the most insane spaghetti garbage the instructor could devise, chock full of GOTOs and the like…and we had an hour to untangle it and rewrite it. I think it went from 300 lines to 14 or something ridiculous like that.

I recall he told us something like “If there’s only one thing you take away from this class, it’s to make sure you never have to to that–with your own code, at least–again.”

---

<div class="post-metadata">

**Author:** ![Doug\_K](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Doug\_K](https://boards.straightdope.com/u/Doug_K)\
**Post date:** [November 19, 2014, 10:19pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/16 "2014-11-19T22:19:01Z")

</div>

> [@eschereal](#):
>
> I think the point of this exercise is that people sometimes write garbage source, so you need to be able to recognize it. Like, if I was teaching some form of C, I would reveal on the last day that _there exist these foul **goto** things and jump labels: and some assholes use them but you, my students never, ever should, just be aware that this garbage exists, so that you are not flummoxed when you see it_.

This brings back memories of a PL/I assignment where it was necessary to use an ON ERROR block. We discovered to our horror that to continue operation after handling the error it was necessary to use a GOTO, otherwise the program would stop at the end of the block.

Naturally I labeled the line to be executed after the ON ERROR block HELL:

---

<div class="post-metadata">

**Author:** ![Budget\_Player\_Cadet](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/budget_player_cadet/32/205_2.png) [@Budget\_Player\_Cadet](https://boards.straightdope.com/u/Budget_Player_Cadet)\
**Post date:** [November 20, 2014, 1:52am UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/17 "2014-11-20T01:52:53Z")

</div>

> [@leahcim](#):
>
> At the risk of attempting a non-boob-related answer (I know some Haskell, but not a lot, and certainly not enough):
> 
> “.” composes two functions, so I’d expect its signature to be something like (a -\> b) -\> (b -\> c) -\> (a -\> c)
> 
> The notation seems to want to compose two composes, so I’d think something like (a -\> b) -\> (b -\> c) -\> (c -\> d) -\> (d -\> e) -\> (a -\> e) or something.
> 
> I seem to recall that **Jragon** actually knows Haskell, so he might come in with a better answer.
> 
> Edited to add: Couldn’t you use Haskell’s infix notation to write the same thing as “(.)(.)(.)” (aka Total-Recall-notation)?

The function takes a function with two input parameters and boils it down to a function with one input parameter. It’s a total fucking mess, but an ingenious total fucking mess. Which is what really gets me. It’s not some mess of code made by some idiot looking for workarounds everywhere. To write something like this coherently, you’d have to be damn good at Haskell. And also terrible at writing good code, because writing it like that would be ass. Also, yeah, total recall notation is the same function. For those wondering, the header is:

f:: (b-\>c)-\>(a-\>a1-\>b)-\>a-\>a1-\>c

So yeah. Total clusterfuck.

> [@eschereal](#):
>
> I think the point of this exercise is that people sometimes write garbage source, so you need to be able to recognize it. Like, if I was teaching some form of C, I would reveal on the last day that _there exist these foul **goto** things and jump labels: and some assholes use them but you, my students never, ever should, just be aware that this garbage exists, so that you are not flummoxed when you see it_.

That would be nice, wouldn’t it.

---

<div class="post-metadata">

**Author:** ![leahcim](https://avatars.discourse-cdn.com/v4/letter/l/b4bc9f/32.png) [@leahcim](https://boards.straightdope.com/u/leahcim)\
**Post date:** [November 20, 2014, 2:15pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/18 "2014-11-20T14:15:48Z")

</div>

> [@Budget\_Player\_Cadet](#):
>
> f:: (b-\>c)-\>(a-\>a1-\>b)-\>a-\>a1-\>c
> 
> So yeah. Total clusterfuck.

That doesn’t seem \*so \*bad as a signature. It looks like it’s just taking a function of two variables (a-\>a1-\>b) and a function of one variable (b-\>c) and creating the function that applies the latter to the result of the former (a-\>a1-\>c). I don’t see off hand how to get that from the boobs, but the signature itself doesn’t seem that bad.

---

<div class="post-metadata">

**Author:** ![Capt.Ridley\_s\_Shooting\_Party](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Capt.Ridley\_s\_Shooting\_Party](https://boards.straightdope.com/u/Capt.Ridley_s_Shooting_Party)\
**Post date:** [November 20, 2014, 5:01pm UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/19 "2014-11-20T17:01:08Z")

</div>

OK, I’ll repeat: the point of the exercise is to demonstrate that you know how Haskell’s type inference works and that you understand polymorphism, as you have three occurrences of the same function all at a different type. Nobody writes Haskell like this in practice as it’s a completely contrived example used for teaching purposes. Further, no Haskell programmer is sitting with pen and paper trying to work out the type of an expression when GHCi exists, in the same way that no mathematician is sitting with pen and paper factoring polynomials when Mathematica exists.

---

<div class="post-metadata">

**Author:** ![Stealth\_Potato](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Stealth\_Potato](https://boards.straightdope.com/u/Stealth_Potato)\
**Post date:** [November 21, 2014, 2:38am UTC](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083/20 "2014-11-21T02:38:48Z")

</div>

Oh man, you _reallllllly_ want to start a flame war, dontcha? 😃

I mean, I’m basically with **Capt. Ridley’s Shooting Party** here – the point of the exercise is to be difficult, to flex your brain bits around a fairly tricky but powerful abstraction. Obviously, when writing production code, you want to make it as straightforward as the circumstances permit, but often the whole _raison d’être_ for exercises is to be abstruse.

> [@Budget\_Player\_Cadet](#):
>
> g = (.) map
> 
> …Or, in non-fucking-stupid-o-vision:
> 
> g function1 function2 list = map (function1 list).function2
> 
> Which, while still a fucking mess, is at least _somewhat_ understandable. I couldn’t even fucking tell you what this would look like for the function above. This is a complete and utter waste of everyone’s time .

I definitely cannot agree with you here. The first version is far more readable. There are no extraneous symbols to confuse the eye or create false impressions. This is perhaps demonstrated by the fact that your proposed reformulation doesn’t do the same thing and in fact does not even have the same type as (.) map. The point-free declaration of _g_ is straightforward: it composes _map_ with another function. That is, _g f_ is the same thing as _map . f_ . Your redefinition of _g_ does something else entirely.

[Next page](https://boards.straightdope.com/t/for-all-the-haskell-fans-out-there/705083.md?page=2)
