[Haskell-cafe] What is your favourite Haskell "aha" moment?
Vaibhav Sagar
vaibhavsagar at gmail.com
Sun Jul 22 09:48:39 UTC 2018
I'm late to this discussion, but one aspect of Haskell that really
impressed me was the idea of *typed holes*, which I think revolutionise
the act of programming. I tried to communicate my love for them to
people who mostly don't know Haskell here:
https://www.youtube.com/watch?v=0oo8wIi2qBE
On 17/07/18 03:28, Johannes Waldmann wrote:
>> - Large-scale refactoring with types:
>> this is a huge selling point for Haskell in general
> I fully agree with the general idea, but the specific example
>
>> data Shape
>> = Circle Double
>> | Square Double
>> | Rectangle Double Double -- ^ added
> is not convincing (well, to programmers
> that know about static typing) Think of a Java program
>
> interface Shape { .. }
> class Circle implement Shape { ... }
>
> When you add class Rectangle { } ,
> then Shape foo = new Rectangle () would be an error,
>
> until you put class Rectangle implements Shape { }
> then the compiler tells you what methods are missing.
>
>
> I think the extra value of types in Haskell
> (for everything, including refactoring)
> is that they tend to express more of the program's properties
> (w.r.t. statically typed imperative programs).
>
> Examples:
>
> the distinction between a and IO a,
> between IO a and STM a.
>
> In Data.Set, function "fromList" has an Ord constraint,
> but "toList" does not. Does "singleton" need the constraint?
> I used this as an exam question just last week.
>
>
> - J.W.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
More information about the Haskell-Cafe
mailing list