What is your favourite Haskell "aha" moment?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
114 messages Options
123456
Reply | Threaded
Open this post in threaded view
|

Re: What is your favourite Haskell "aha" moment?

Jerzy Karczmarczuk

Le 12/07/2018 à 15:01, Brett Gilio reacts :

Alexey, could you expand on what you mean in your first point? I am quite intrigued. I do not use Haskell often, but that could be something of interest to me in-and-out of Haskell.

Brett Gilio

Alexey Raga wrote:
...major reasons

1. The ability to define the specification (types) and then "just" follow them in implementation. Sometimes even without having a clear understanding of the things I was using, I felt (and still feel) guided towards the right solution.
I am not Alexey Raga, who precises:
when I wrote a signature for my function, the compiler will make its best to help me implement it. It will yell at me, it will not let me use things that I am not supposed to use (according to constraints), etc.
===
... but I think that there is more to tell, since in *all languages* the compiler makes its best to profit from typing in order to optimize the implementation...
With polymorphic typing and automatic type inference, the compiler can do a little more, it seems that people forgot already the "toy" (not so...) of Lennart Augustsson, named Djinn, which takes a type and proposes an object of this type, using the intuitionistic logic theorem prover (the current Djinn library dates back to 2014, but Lennart manufactured  it already in 2006, or before,  if I am not mistaken. He quotes Roy Dyckhoff, and Don Stewart). Here is a test:

Djinn> f ? (a,b) -> (b,a)   -- my input
f :: (a, b) -> (b, a)
f (a, b) = (b, a)

Doaitse Swierstra comments:
swap (a, b) = (b, a)

Once you ask for the type you get (a, b) -> (b, a), hence the type completely specifies what swap computes, and the function is even more general than the version of the type above.
I don't see that last point... Anyway, the typing power of Haskell should be known.
Thx.

Jerzy Karczmarczuk


 

 


Garanti sans virus. www.avast.com

_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is your favourite Haskell "aha" moment?)

Joachim Durchholz
In reply to this post by Vanessa McHale
Am 12.07.2018 um 12:28 schrieb Vanessa McHale:
> I am not familiar with F#.

F# is OCaml, ported and adapted to .net.
Or at least it started that way; I don't know how far they have diverged.

Regards,
Jo
_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is your favourite Haskell "aha" moment?)

Chris Smith-31
In reply to this post by Paul
Oops, readding the mailing list.

On Thu, Jul 12, 2018 at 12:59 PM Chris Smith <[hidden email]> wrote:
I'll answer this, since I have been teaching Haskell to children for six years or so. :)

I think it's important to distinguish between Haskell AS USED in most of the community, and Haskell as it COULD be used.  I agree that you don't want to teach the first of those to children.  But Haskell is still a great teaching choice, mainly because GHC is so configurable that you can create the environment you want, and just build it with a Haskell compiler.  With GHC plugins, this is becoming even more true, but it already arises from a combination of (a) very lightweight and intuitive core syntax in the first place, (b) great support for custom preludes, and (c) the RebindableSyntax extension, and the fact that so much syntax is defined in terms of desugaring.

If you're seriously talking about teaching children, then your concerns about web frameworks and such are a bit silly.  (Unless by "children" you meant mid to late teens and after, in which case this becomes relevant.)  "Advanced" type features are also not particularly relevant (though there's some fuzziness about what counts as "advanced"; for instance, I've recently decided it's better to teach GADT syntax as the only option for defining algebraic data types, even though I never expect most students to take advantage of the extra power of GADTs.)

The main concern I have with F#, though, is that the semantics are far too complex.  It has all the power of a functional language, but none of the semantic simplicity. If students already struggle with compositional programming (and they do), they struggle even more when the simplest way to understand what's going on -- namely, substitution -- is taken away from them.  If you're going to teach a computational model based on sequencing actions on a global state (the state being the screen, network, etc.), then you might as well include mutable variables in that global state, and you might as well teach Python, which will at least be more intuitive, if not simpler.

On Thu, Jul 12, 2018 at 7:46 AM PY <[hidden email]> wrote:

I am afraid that it can lead to flame again, but F# has super-capacity: you can check measuring units, type providers, computation expressions, active patterns, static/dynamic types constraints, constraints on existing method, etc... It's clean, borrows some ideas from Haskell, some are original and Haskell borrows them (but with worse implementation). IMHO for children teaching to FP F# is the best. Even more, currently C# also has a lot of FP features (https://github.com/dotnet/csharplang/blob/master/proposals/patterns.md#arithmetic-simplification  -- is not it super easy and beauty?). Rust is more low level: you should think about memory "management", OOP has some problems... And serious argument for children teaching: salary trends (joke sure) :-) But you can compare salary in F# and Haskell, for example - people often choice language after check current salaries in the market. Also F# is more focused on realistic tasks and business value. It lacks performance, UWP yet (but in progress)... To feel how F# is sexy compare Web application written in Websharper and in any Haskell framework. Haskell is beauty but I'm afraid its fate unfortunately will be the same as one of Common Lisp, NetBSD, etc - it's ground for ideas and experiments and has disputable design. Also it's more-more difficult to teach children to Haskell than to F#...

IMHO is general to teach FP is more easy than to teach OOP if FP is not Haskell (some language which targets more eager/efficient/dynamic/real goals instead of abstract types playing).

12.07.2018 13:28, Vanessa McHale wrote:
I wouldn't say Rust has a large capacity for FP. I am not familiar with
F#. The thing that makes FP infeasible in Rust is not the lack of purity
but rather the fact that affine types make it difficult to treat
functions as first-class values.


On 07/12/2018 01:40 AM, Brett Gilio wrote:
Tony,

I am curious on your attitude towards multi-paradigm and ML-like
languages. I agree that functional programming is easily the better of
the bundle in many forms of application logic and elegance (which is
why I have come to love Scheme and Haskell), but do you see any room
for those languages like F# or Rust which have large capacities for FP
but are either functional-first (but not pure) or a hybrid?

Brett Gilio

On 07/12/2018 01:35 AM, Tony Morris wrote:
  I used to teach undergrad OOP nonsense. I have been teaching FP for 15
years. [^1]

The latter is *way* easier. Existing programmers are more difficult than
children, but still way easier to teach FP than all the other stuff.

[^1]: Canberra anyone? https://qfpl.io/posts/2018-canberra-intro-to-fp/


On 07/12/2018 04:23 PM, Joachim Durchholz wrote:
Am 11.07.2018 um 16:36 schrieb Damian Nadales:
I speak only from my own narrow perspective. I'd say programming is
hard, but functional programming is harder.
Actually it's pretty much the opposite, I hear from teachers.

Maybe that's why Java replaced Haskell in some universities
curricula
The considerations are marketable skills.
A considerable fraction of students is looking at the curriculum and
at job offers, and if they find that the lists don't match, they will
go to another university.
Also, industry keeps lobbying for teaching skills that they can use.
Industry can give money to universities so this gives them influence
on the curriculum (and only if they get time to talk the topic over
with the dean). This aspect can vary considerably between countries,
depending on how much money the universities tend to acquire from
industry.

https://chrisdone.com/posts/dijkstra-haskell-java. For some reason
most programmers I know are not scared of learning OO, but they fear
functional programming.
Programmers were *very* scared of OO in the nineties. It took roughly
a decade or two (depending on where you put the starting point) to get
comfortable with OO.


            
   I think the reason might be that OO concepts
like inheritance and passing messages between objects are a bit more
concrete and easier to grasp (when you present toy examples at least).
OO is about how to deal with having to pack everything into its own
class (and how to arrange stuff into classes).
Functional is about how to deal with the inability to update. Here,
the functional camp actually has the easier job, because you can just
tell people to just write code that creates new data objects and get
over with it. Performance concerns can be handwaved away by saying
that the compiler is hyper-aggressive, and "you can look at the
intermediate code if you suspect the compiler is the issue".
(Functional is a bit similar to SQL here, but the SQL optimizers are
much less competent than GHC at detecting optimization opportunities.)

Then you have design patterns, which have intuitive names and give
some very general guidelines that one can try after reading them (and
add his/her own personal twist). I doubt people can read the Monad
laws and make any sense out of them at the first try.
That's true, but much of the misconceptions around monads from the
first days have been cleared up.
But yes the monad laws are too hard to read. OTOH you won't be able to
read the Tree code in the JDK without the explanations either.
_______________________________________________
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.



_______________________________________________
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.

_______________________________________________
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.

      

_______________________________________________
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.

_______________________________________________
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.

_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is your favourite Haskell "aha" moment?)

Donn Cave-4
In reply to this post by Joachim Durchholz
quoth Joachim Durchholz <[hidden email]>
 
> F# is OCaml, ported and adapted to .net.
> Or at least it started that way; I don't know how far they have diverged.

Rather far.  Don't quote me, I know only what I've read about F# and
am not sure I know that, but lots of Objective CAML was tossed, and
of course there's a lot of .NET.  The syntax apparently uses significant
white space, so that's one huge step forward if it works - the standard
Objective CAML syntax is quite evil in that respect.  But I believe the
interesting parts are gone: modules, and the OOP implementation, which
I have the impression might be one of the more respectable OO designs.

        Donn
_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is your favourite Haskell "aha" moment?)

J. Garrett Morris-5
In reply to this post by Joachim Durchholz
On Thu, Jul 12, 2018 at 1:24 AM Joachim Durchholz <[hidden email]> wrote:
> > Maybe that's why Java replaced Haskell in some universities
> > curricula
>
> The considerations are marketable skills.

That's certainly a consideration.  I doubt it weighs particularly
heavy on the departments at Austin, Berkeley, or MIT however.  Their
graduates will be plenty marketable regardless of the languages they
see most as undergraduates.

Another concern is who the courses serve.  At my institution, our
intro programming courses serve both electrical engineering and
computer science, so we have to include the EE folks needs in our
considerations.  Many institutions (Harvey Mudd has done an excellent
job of this) are also serving the wider data science community with
the same introductory course (albeit different sections).  This is
great news for exposing people to computer science, but may impose
additional requirements on how you teach.

Yet another concern is teaching load.  At my (relatively small) state
institution, we teach something like 4 sections of programming I, and
at least another two sections of intro CS for non-majors.  If I were
to champion updating that part of the curriculum, it'd be on me to
teach those sections, or to work with/train instructors to be able to
do so.  This is a non-trivial time commitment, and there's not
necessarily any guarantee that whoever ended up with the intro
sequence after I ran out of energy/time/employment would have the same
priorities.

A final note is that, just because a department chooses to teach their
introductory course in an imperative language doesn't mean they're
teaching C-style procedural programming.  Look at Harvey Mudd's CS 5
book: https://www.cs.hmc.edu/csforall/.  It's taught in Python, but
the first half of the book focuses on functional programming
paradigms.

 /g
_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is yourfavourite Haskell "aha" moment?)

Paul
In reply to this post by Donn Cave-4

ML structures/signatures/functors are gone IMHO due to namespaces and F# modules. As I know attempts to be more close to Haskell fail, so Microsoft decides to switch to ML as own dialect. All decisions were taken because of .NET architecture, sure (and OOP is close to .NET, original Ocaml OOP was not easy adapting). But for me it looks cool. For example, syntax for objects looks canonical, not like something alien for ML. My IMHO is that Microsoft takes right direction in F# as well as C#.

 

 

 

From: [hidden email]
Sent: 12 июля 2018 г. 20:21
To: [hidden email]
Subject: Re: [Haskell-cafe] Investing in languages (Was: What is yourfavourite Haskell "aha" moment?)

 

quoth Joachim Durchholz <[hidden email]>

> F# is OCaml, ported and adapted to .net.

> Or at least it started that way; I don't know how far they have diverged.

 

Rather far.  Don't quote me, I know only what I've read about F# and

am not sure I know that, but lots of Objective CAML was tossed, and

of course there's a lot of .NET.  The syntax apparently uses significant

white space, so that's one huge step forward if it works - the standard

Objective CAML syntax is quite evil in that respect.  But I believe the

interesting parts are gone: modules, and the OOP implementation, which

I have the impression might be one of the more respectable OO designs.

 

           Donn

_______________________________________________

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.

 


_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is yourfavouriteHaskell "aha" moment?)

Paul
In reply to this post by Paul

Wooow! Yes!!

But today there is serious competition (Smalltalk, Python; I planned Scratch – but it’s for children of 7-9 years). I thing you are good teacher 😊

Btw, what do you think: what is better – textual programming or visual programming for children? For me, Labview/G was insight in 90s 😊 Today there is Luna language – it’s visual too. IMHO visual programming better illustrates ideas/concepts, or?

 

From: [hidden email]
Sent: 12 июля 2018 г. 21:00
To: [hidden email]
Subject: Re: [Haskell-cafe] Investing in languages (Was: What is yourfavouriteHaskell "aha" moment?)

 

Perhaps you mean something fun and visual like this? https://code.world/#PhFFj32Bx0FcpQvvoVJW0xw

 

These are written in the simplified variant of Haskell that I teach, which uses a custom Prelude that skips type classes and other advanced features, uses rebindable syntax to simplify types (for example, you'll see Number instead of Int, Double, etc.), and automatically provides graphics functions that work in the browser.

 

On Thu, Jul 12, 2018 at 1:54 PM Paul <[hidden email]> wrote:

Hmm, Chris, thanks for answer. Interesting. I was surprised when I first learned that someone somewhere is teaching the children to Haskell, but if you say so – then it’s possible and may be it’s good! 😊  

Sometimes children don’t like right things, but like fun. So, I though that more preferable to show them some bright demo: UI, graphics, some simple games, databases, to rise the interest, you know – this feeling of first code. First “wooow! It works!!!” 😊 Haskell, for me, looks pedantic, not for fun. May be I’m not right, I have not such experience.

 

 

From: [hidden email]
Sent: 12 июля 2018 г. 19:59
To: [hidden email]
Subject: Re: [Haskell-cafe] Investing in languages (Was: What is yourfavourite Haskell "aha" moment?)

 

I'll answer this, since I have been teaching Haskell to children for six years or so. :)

 

I think it's important to distinguish between Haskell AS USED in most of the community, and Haskell as it COULD be used.  I agree that you don't want to teach the first of those to children.  But Haskell is still a great teaching choice, mainly because GHC is so configurable that you can create the environment you want, and just build it with a Haskell compiler.  With GHC plugins, this is becoming even more true, but it already arises from a combination of (a) very lightweight and intuitive core syntax in the first place, (b) great support for custom preludes, and (c) the RebindableSyntax extension, and the fact that so much syntax is defined in terms of desugaring.

 

If you're seriously talking about teaching children, then your concerns about web frameworks and such are a bit silly.  (Unless by "children" you meant mid to late teens and after, in which case this becomes relevant.)  "Advanced" type features are also not particularly relevant (though there's some fuzziness about what counts as "advanced"; for instance, I've recently decided it's better to teach GADT syntax as the only option for defining algebraic data types, even though I never expect most students to take advantage of the extra power of GADTs.)

 

The main concern I have with F#, though, is that the semantics are far too complex.  It has all the power of a functional language, but none of the semantic simplicity. If students already struggle with compositional programming (and they do), they struggle even more when the simplest way to understand what's going on -- namely, substitution -- is taken away from them.  If you're going to teach a computational model based on sequencing actions on a global state (the state being the screen, network, etc.), then you might as well include mutable variables in that global state, and you might as well teach Python, which will at least be more intuitive, if not simpler.

 

On Thu, Jul 12, 2018 at 7:46 AM PY <[hidden email]> wrote:

I am afraid that it can lead to flame again, but F# has super-capacity: you can check measuring units, type providers, computation expressions, active patterns, static/dynamic types constraints, constraints on existing method, etc... It's clean, borrows some ideas from Haskell, some are original and Haskell borrows them (but with worse implementation). IMHO for children teaching to FP F# is the best. Even more, currently C# also has a lot of FP features (https://github.com/dotnet/csharplang/blob/master/proposals/patterns.md#arithmetic-simplification  -- is not it super easy and beauty?). Rust is more low level: you should think about memory "management", OOP has some problems... And serious argument for children teaching: salary trends (joke sure) :-) But you can compare salary in F# and Haskell, for example - people often choice language after check current salaries in the market. Also F# is more focused on realistic tasks and business value. It lacks performance, UWP yet (but in progress)... To feel how F# is sexy compare Web application written in Websharper and in any Haskell framework. Haskell is beauty but I'm afraid its fate unfortunately will be the same as one of Common Lisp, NetBSD, etc - it's ground for ideas and experiments and has disputable design. Also it's more-more difficult to teach children to Haskell than to F#...

IMHO is general to teach FP is more easy than to teach OOP if FP is not Haskell (some language which targets more eager/efficient/dynamic/real goals instead of abstract types playing).

12.07.2018 13:28, Vanessa McHale wrote:

I wouldn't say Rust has a large capacity for FP. I am not familiar with
F#. The thing that makes FP infeasible in Rust is not the lack of purity
but rather the fact that affine types make it difficult to treat
functions as first-class values.
 
 
On 07/12/2018 01:40 AM, Brett Gilio wrote:
Tony,
 
I am curious on your attitude towards multi-paradigm and ML-like
languages. I agree that functional programming is easily the better of
the bundle in many forms of application logic and elegance (which is
why I have come to love Scheme and Haskell), but do you see any room
for those languages like F# or Rust which have large capacities for FP
but are either functional-first (but not pure) or a hybrid?
 
Brett Gilio
 
On 07/12/2018 01:35 AM, Tony Morris wrote:
  I used to teach undergrad OOP nonsense. I have been teaching FP for 15
years. [^1]
 
The latter is *way* easier. Existing programmers are more difficult than
children, but still way easier to teach FP than all the other stuff.
 
[^1]: Canberra anyone? https://qfpl.io/posts/2018-canberra-intro-to-fp/
 
 
On 07/12/2018 04:23 PM, Joachim Durchholz wrote:
Am 11.07.2018 um 16:36 schrieb Damian Nadales:
 
I speak only from my own narrow perspective. I'd say programming is
hard, but functional programming is harder.
 
Actually it's pretty much the opposite, I hear from teachers.
 
Maybe that's why Java replaced Haskell in some universities
curricula
The considerations are marketable skills.
A considerable fraction of students is looking at the curriculum and
at job offers, and if they find that the lists don't match, they will
go to another university.
Also, industry keeps lobbying for teaching skills that they can use.
Industry can give money to universities so this gives them influence
on the curriculum (and only if they get time to talk the topic over
with the dean). This aspect can vary considerably between countries,
depending on how much money the universities tend to acquire from
industry.
 
https://chrisdone.com/posts/dijkstra-haskell-java. For some reason
most programmers I know are not scared of learning OO, but they fear
functional programming.
 
Programmers were *very* scared of OO in the nineties. It took roughly
a decade or two (depending on where you put the starting point) to get
comfortable with OO.
 
 
   I think the reason might be that OO concepts
like inheritance and passing messages between objects are a bit more
concrete and easier to grasp (when you present toy examples at least).
 
OO is about how to deal with having to pack everything into its own
class (and how to arrange stuff into classes).
Functional is about how to deal with the inability to update. Here,
the functional camp actually has the easier job, because you can just
tell people to just write code that creates new data objects and get
over with it. Performance concerns can be handwaved away by saying
that the compiler is hyper-aggressive, and "you can look at the
intermediate code if you suspect the compiler is the issue".
(Functional is a bit similar to SQL here, but the SQL optimizers are
much less competent than GHC at detecting optimization opportunities.)
 
Then you have design patterns, which have intuitive names and give
some very general guidelines that one can try after reading them (and
add his/her own personal twist). I doubt people can read the Monad
laws and make any sense out of them at the first try.
 
That's true, but much of the misconceptions around monads from the
first days have been cleared up.
But yes the monad laws are too hard to read. OTOH you won't be able to
read the Tree code in the JDK without the explanations either.
_______________________________________________
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.
 
 
 
 
_______________________________________________
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.
 
_______________________________________________
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.
 

 

_______________________________________________
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.

 

_______________________________________________
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.

 

 


_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is your favourite Haskell "aha" moment?)

Joachim Durchholz
In reply to this post by J. Garrett Morris-5
Am 12.07.2018 um 19:50 schrieb J. Garrett Morris:

> On Thu, Jul 12, 2018 at 1:24 AM Joachim Durchholz <[hidden email]> wrote:
>>> Maybe that's why Java replaced Haskell in some universities
>>> curricula
>>
>> The considerations are marketable skills.
>
> That's certainly a consideration.  I doubt it weighs particularly
> heavy on the departments at Austin, Berkeley, or MIT however.  Their
> graduates will be plenty marketable regardless of the languages they
> see most as undergraduates.

Yes, but 90% of universities are not elite, and since these educate 90%
of the students, we still end with a prevalence of marketable
programming language skills.

Not that I'm criticizing this. Not too strongly anyway; there are
positive and negative aspects to this.

(Thanks for the rest, leaving it out because I have nothing of value to
add, not because I disagree.)
_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: What is your favourite Haskell "aha" moment?

Magnus Therning
In reply to this post by Haskell - Haskell-Cafe mailing list
On Wed, 11 Jul 2018, 14:10 Simon Peyton Jones via Haskell-Cafe, <[hidden email]> wrote:

Friends

In a few weeks I’m giving a talk to a bunch of genomics folk at the Sanger Institute about Haskell.   They do lots of programming, but they aren’t computer scientists.

I can tell them plenty about Haskell, but I’m ill-equipped to answer the main question in their minds: why should I even care about Haskell?  I’m too much of a biased witness.

So I thought I’d ask you for help.  War stories perhaps – how using Haskell worked (or didn’t) for you.  But rather than talk generalities, I’d love to illustrate with copious examples of beautiful code.

  • Can you identify a few lines of Haskell that best characterise what you think makes Haskell distinctively worth caring about?   Something that gave you an “aha” moment, or that feeling of joy when you truly make sense of something for the first time.

The challenge is, of course, that this audience will know no Haskell, so muttering about Cartesian Closed Categories isn’t going to do it for them.  I need examples that I can present in 5 minutes, without needing a long setup.

To take a very basic example, consider Quicksort using list comprehensions, compared with its equivalent in C.  It’s so short, so obviously right, whereas doing the right thing with in-place update in C notoriously prone to fencepost errors etc.  But it also makes much less good use of memory, and is likely to run slower.  I think I can do that in 5 minutes.

Another thing that I think comes over easily is the ability to abstract: generalising sum and product to fold by abstracting out a functional argument; generalising at the type level by polymorphism, including polymorphism over higher-kinded type constructors.   Maybe 8 minutes.

But you will have more and better ideas, and (crucially) ideas that are more credibly grounded in the day to day reality of writing programs that get work done.

Pointers to your favourite blog posts would be another avenue.  (I love the Haskell Weekly News.)

Finally, I know that some of you use Haskell specifically for genomics work, and maybe some of your insights would be particularly relevant for the Sanger audience.

Thank you!  Perhaps your responses on this thread (if any) may be helpful to more than just me.


I wrote something about just this a few years ago, one such moment for me: http://therning.org/magnus/posts/2007-10-22-324-aha-one-liners.html

/M

_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages

Stefan Monnier
In reply to this post by Joachim Durchholz
> Yes, but 90% of universities are not elite, and since these educate 90% of
> the students, we still end with a prevalence of marketable programming
> language skills.

BTW, the choice of programming language is also often influenced by the
whole CS faculty members (not just the programming-language guys), and
guess what: most of them don't use anything like Haskell in
their projects.


        Stefan

_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is yourfavouriteHaskell "aha" moment?)

Chris Smith-31
In reply to this post by Paul
This is a good question, and I think it depends on your goals.

If your goal is to inspire interest and attract children to programming, then you are best served by making it obvious what can and can't be done, and making it very difficult to make a mistake.  Some visual languages are very good at this, and Scratch, for example, is a good example.  Going even further, Scratch and similar languages are often used in situations where the students can do literally anything, and *something* interesting happens, inspiring that spark of excitement and feeling of "I did that!"  This is a magical moment, and it can change lives.

On the other hand, building new skills is the point of educating.  Avoiding the need for new skills means avoiding the opportunity to learn.  Children often still struggle with precise perception.  I've seen plenty of students as old as 12 to 13 who literally cannot see whether there's a comma in an expression, or whether a word is spelled "ie" or "ei", without extreme measures like covering the surrounding text.  Their brain just skips over these concerns.  Of course, they struggle in mathematics, and also basic language and communication.  Once again, one can avoid the problem and try to help them to be successful without needing that skill, which a visual language is great at.  But of course, they ultimately do need the skill in order to communicate in the first place!  So there's also value in placing them in an environment where they need to learn it.  When making this decision, though, it's important to focus on skills that are truly necessary, and not (for example) remembering what order to write "public static void main" in their Java programs.

On Thu, Jul 12, 2018 at 2:16 PM Paul <[hidden email]> wrote:

Wooow! Yes!!

But today there is serious competition (Smalltalk, Python; I planned Scratch – but it’s for children of 7-9 years). I thing you are good teacher 😊

Btw, what do you think: what is better – textual programming or visual programming for children? For me, Labview/G was insight in 90s 😊 Today there is Luna language – it’s visual too. IMHO visual programming better illustrates ideas/concepts, or?

 

From: [hidden email]
Sent: 12 июля 2018 г. 21:00
To: [hidden email]
Subject: Re: [Haskell-cafe] Investing in languages (Was: What is yourfavouriteHaskell "aha" moment?)

 

Perhaps you mean something fun and visual like this? https://code.world/#PhFFj32Bx0FcpQvvoVJW0xw

 

These are written in the simplified variant of Haskell that I teach, which uses a custom Prelude that skips type classes and other advanced features, uses rebindable syntax to simplify types (for example, you'll see Number instead of Int, Double, etc.), and automatically provides graphics functions that work in the browser.

 

On Thu, Jul 12, 2018 at 1:54 PM Paul <[hidden email]> wrote:

Hmm, Chris, thanks for answer. Interesting. I was surprised when I first learned that someone somewhere is teaching the children to Haskell, but if you say so – then it’s possible and may be it’s good! 😊  

Sometimes children don’t like right things, but like fun. So, I though that more preferable to show them some bright demo: UI, graphics, some simple games, databases, to rise the interest, you know – this feeling of first code. First “wooow! It works!!!” 😊 Haskell, for me, looks pedantic, not for fun. May be I’m not right, I have not such experience.

 

 

From: [hidden email]
Sent: 12 июля 2018 г. 19:59
To: [hidden email]
Subject: Re: [Haskell-cafe] Investing in languages (Was: What is yourfavourite Haskell "aha" moment?)

 

I'll answer this, since I have been teaching Haskell to children for six years or so. :)

 

I think it's important to distinguish between Haskell AS USED in most of the community, and Haskell as it COULD be used.  I agree that you don't want to teach the first of those to children.  But Haskell is still a great teaching choice, mainly because GHC is so configurable that you can create the environment you want, and just build it with a Haskell compiler.  With GHC plugins, this is becoming even more true, but it already arises from a combination of (a) very lightweight and intuitive core syntax in the first place, (b) great support for custom preludes, and (c) the RebindableSyntax extension, and the fact that so much syntax is defined in terms of desugaring.

 

If you're seriously talking about teaching children, then your concerns about web frameworks and such are a bit silly.  (Unless by "children" you meant mid to late teens and after, in which case this becomes relevant.)  "Advanced" type features are also not particularly relevant (though there's some fuzziness about what counts as "advanced"; for instance, I've recently decided it's better to teach GADT syntax as the only option for defining algebraic data types, even though I never expect most students to take advantage of the extra power of GADTs.)

 

The main concern I have with F#, though, is that the semantics are far too complex.  It has all the power of a functional language, but none of the semantic simplicity. If students already struggle with compositional programming (and they do), they struggle even more when the simplest way to understand what's going on -- namely, substitution -- is taken away from them.  If you're going to teach a computational model based on sequencing actions on a global state (the state being the screen, network, etc.), then you might as well include mutable variables in that global state, and you might as well teach Python, which will at least be more intuitive, if not simpler.

 

On Thu, Jul 12, 2018 at 7:46 AM PY <[hidden email]> wrote:

I am afraid that it can lead to flame again, but F# has super-capacity: you can check measuring units, type providers, computation expressions, active patterns, static/dynamic types constraints, constraints on existing method, etc... It's clean, borrows some ideas from Haskell, some are original and Haskell borrows them (but with worse implementation). IMHO for children teaching to FP F# is the best. Even more, currently C# also has a lot of FP features (https://github.com/dotnet/csharplang/blob/master/proposals/patterns.md#arithmetic-simplification  -- is not it super easy and beauty?). Rust is more low level: you should think about memory "management", OOP has some problems... And serious argument for children teaching: salary trends (joke sure) :-) But you can compare salary in F# and Haskell, for example - people often choice language after check current salaries in the market. Also F# is more focused on realistic tasks and business value. It lacks performance, UWP yet (but in progress)... To feel how F# is sexy compare Web application written in Websharper and in any Haskell framework. Haskell is beauty but I'm afraid its fate unfortunately will be the same as one of Common Lisp, NetBSD, etc - it's ground for ideas and experiments and has disputable design. Also it's more-more difficult to teach children to Haskell than to F#...

IMHO is general to teach FP is more easy than to teach OOP if FP is not Haskell (some language which targets more eager/efficient/dynamic/real goals instead of abstract types playing).

12.07.2018 13:28, Vanessa McHale wrote:

I wouldn't say Rust has a large capacity for FP. I am not familiar with
F#. The thing that makes FP infeasible in Rust is not the lack of purity
but rather the fact that affine types make it difficult to treat
functions as first-class values.
 
 
On 07/12/2018 01:40 AM, Brett Gilio wrote:
Tony,
 
I am curious on your attitude towards multi-paradigm and ML-like
languages. I agree that functional programming is easily the better of
the bundle in many forms of application logic and elegance (which is
why I have come to love Scheme and Haskell), but do you see any room
for those languages like F# or Rust which have large capacities for FP
but are either functional-first (but not pure) or a hybrid?
 
Brett Gilio
 
On 07/12/2018 01:35 AM, Tony Morris wrote:
  I used to teach undergrad OOP nonsense. I have been teaching FP for 15
years. [^1]
 
The latter is *way* easier. Existing programmers are more difficult than
children, but still way easier to teach FP than all the other stuff.
 
[^1]: Canberra anyone? https://qfpl.io/posts/2018-canberra-intro-to-fp/
 
 
On 07/12/2018 04:23 PM, Joachim Durchholz wrote:
Am 11.07.2018 um 16:36 schrieb Damian Nadales:
 
I speak only from my own narrow perspective. I'd say programming is
hard, but functional programming is harder.
 
Actually it's pretty much the opposite, I hear from teachers.
 
Maybe that's why Java replaced Haskell in some universities
curricula
The considerations are marketable skills.
A considerable fraction of students is looking at the curriculum and
at job offers, and if they find that the lists don't match, they will
go to another university.
Also, industry keeps lobbying for teaching skills that they can use.
Industry can give money to universities so this gives them influence
on the curriculum (and only if they get time to talk the topic over
with the dean). This aspect can vary considerably between countries,
depending on how much money the universities tend to acquire from
industry.
 
https://chrisdone.com/posts/dijkstra-haskell-java. For some reason
most programmers I know are not scared of learning OO, but they fear
functional programming.
 
Programmers were *very* scared of OO in the nineties. It took roughly
a decade or two (depending on where you put the starting point) to get
comfortable with OO.
 
 
   I think the reason might be that OO concepts
like inheritance and passing messages between objects are a bit more
concrete and easier to grasp (when you present toy examples at least).
 
OO is about how to deal with having to pack everything into its own
class (and how to arrange stuff into classes).
Functional is about how to deal with the inability to update. Here,
the functional camp actually has the easier job, because you can just
tell people to just write code that creates new data objects and get
over with it. Performance concerns can be handwaved away by saying
that the compiler is hyper-aggressive, and "you can look at the
intermediate code if you suspect the compiler is the issue".
(Functional is a bit similar to SQL here, but the SQL optimizers are
much less competent than GHC at detecting optimization opportunities.)
 
Then you have design patterns, which have intuitive names and give
some very general guidelines that one can try after reading them (and
add his/her own personal twist). I doubt people can read the Monad
laws and make any sense out of them at the first try.
 
That's true, but much of the misconceptions around monads from the
first days have been cleared up.
But yes the monad laws are too hard to read. OTOH you won't be able to
read the Tree code in the JDK without the explanations either.
_______________________________________________
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.
 
 
 
 
_______________________________________________
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.
 
_______________________________________________
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.
 

 

_______________________________________________
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.

 

_______________________________________________
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.

 

 


_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages

Stuart A. Kurtz
In reply to this post by Stefan Monnier
Dear Stefan,

> BTW, the choice of programming language is also often influenced by the
> whole CS faculty members (not just the programming-language guys), and
> guess what: most of them don't use anything like Haskell in
> their projects.

I suspect this varies from institution to institution. My experience is that the faculty who most often teach a course have the most to say regarding its subject matter. Of course, the decision isn’t a simple matter of personal preference, as there are other collegial considerations, e.g., preparing students for subsequent classes, and in making it easy to recruit other faculty and teaching staff to cover other sections.

What this has meant at Chicago is that our mainstream intro course starts with Typed Racket, even though John Reppy (who regularly teaches it) would naturally prefer SMLNJ. On the other hand, the course was Scheme/Racket before, and the movement to Typed Racket is consistent with both the longstanding traditions of the course (which go back to SICP), and the idiosyncrasies of its faculty lead. On the other hand, I teach the honors version, and for many years the only section of it. Having no one to satisfy but myself, I settled on Haskell. These days, there’s a second section, and Ravi Chugh and I collaborate. FWIW, I’m not a PL guy, but rather am a theoretician via mathematical logic and computability theory. We get less push-back than you’d expect, as the quality of our students is taken as indicative of the quality of our choices.

My public justification for teaching Haskell is that the honors students I encounter either already have programming experience (usually Java, these days), or are hard core math geeks. Both have something substantial to add to the course, and their disadvantages and advantages largely offset. It makes for a productive community. My private justification includes the public one, but adds the very real consideration that by teaching Haskell, I continue to grow with the language and its practice. Ravi and I end up re-writing about 1/4th to 1/3rd of the course every year, which keeps it and us fresh.

Peace,

Stu

---------------

Stuart A. Kurtz
Professor, Department of Computer Science and the College
Master, Physical Sciences Collegiate Division
The University of Chicago


_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is your favourite Haskell "aha" moment?)

Sergiu Ivanov-2
In reply to this post by Chris Smith-31
Hello Chris,

Thus quoth  Chris Smith  on Thu Jul 12 2018 at 22:48 (+0200):
> I've seen plenty of students as old as 12 to 13 who literally cannot
> see whether there's a comma in an expression, or whether a word is
> spelled "ie" or "ei", without extreme measures like covering the
> surrounding text.

This sounds a lot like symptoms of dyslexia.  Are you talking about
students _without_ such disorders?

-
Sergiu


Thus quoth  Chris Smith  on Thu Jul 12 2018 at 22:48 (+0200):

> This is a good question, and I think it depends on your goals.
>
> If your goal is to inspire interest and attract children to programming,
> then you are best served by making it obvious what can and can't be done,
> and making it very difficult to make a mistake.  Some visual languages are
> very good at this, and Scratch, for example, is a good example.  Going even
> further, Scratch and similar languages are often used in situations where
> the students can do literally anything, and *something* interesting
> happens, inspiring that spark of excitement and feeling of "I did that!"
> This is a magical moment, and it can change lives.
>
> On the other hand, building new skills is the point of educating.  Avoiding
> the need for new skills means avoiding the opportunity to learn.  Children
> often still struggle with precise perception.  I've seen plenty of students
> as old as 12 to 13 who literally cannot see whether there's a comma in an
> expression, or whether a word is spelled "ie" or "ei", without extreme
> measures like covering the surrounding text.  Their brain just skips over
> these concerns.  Of course, they struggle in mathematics, and also basic
> language and communication.  Once again, one can avoid the problem and try
> to help them to be successful without needing that skill, which a visual
> language is great at.  But of course, they ultimately do need the skill in
> order to communicate in the first place!  So there's also value in placing
> them in an environment where they need to learn it.  When making this
> decision, though, it's important to focus on skills that are truly
> necessary, and not (for example) remembering what order to write "public
> static void main" in their Java programs.
>
> On Thu, Jul 12, 2018 at 2:16 PM Paul <[hidden email]> wrote:
>
>> Wooow! Yes!!
>>
>> But today there is serious competition (Smalltalk, Python; I planned
>> Scratch – but it’s for children of 7-9 years). I thing you are good teacher
>> 😊
>>
>> Btw, what do you think: what is better – textual programming or visual
>> programming for children? For me, Labview/G was insight in 90s 😊 Today
>> there is Luna language – it’s visual too. IMHO visual programming better
>> illustrates ideas/concepts, or?
>>
>>
>>
>> *From: *Chris Smith <[hidden email]>
>> *Sent: *12 июля 2018 г. 21:00
>> *To: *[hidden email]
>> *Subject: *Re: [Haskell-cafe] Investing in languages (Was: What is
>> yourfavouriteHaskell "aha" moment?)
>>
>>
>>
>> Perhaps you mean something fun and visual like this?
>> https://code.world/#PhFFj32Bx0FcpQvvoVJW0xw
>>
>> Or this? https://code.world/#PO1BKCj-kA9ztKKnE7rOueA
>>
>>
>>
>> These are written in the simplified variant of Haskell that I teach, which
>> uses a custom Prelude that skips type classes and other advanced features,
>> uses rebindable syntax to simplify types (for example, you'll see Number
>> instead of Int, Double, etc.), and automatically provides graphics
>> functions that work in the browser.
>>
>>
>>
>> On Thu, Jul 12, 2018 at 1:54 PM Paul <[hidden email]> wrote:
>>
>> Hmm, Chris, thanks for answer. Interesting. I was surprised when I first
>> learned that someone somewhere is teaching the children to Haskell, but if
>> you say so – then it’s possible and may be it’s good! 😊
>>
>> Sometimes children don’t like right things, but like fun. So, I though
>> that more preferable to show them some bright demo: UI, graphics, some
>> simple games, databases, to rise the interest, you know – this feeling of
>> first code. First “wooow! It works!!!” 😊 Haskell, for me, looks
>> pedantic, not for fun. May be I’m not right, I have not such experience.
>>
>>
>>
>>
>>
>> *From: *Chris Smith <[hidden email]>
>> *Sent: *12 июля 2018 г. 19:59
>> *To: *[hidden email]
>> *Subject: *Re: [Haskell-cafe] Investing in languages (Was: What is
>> yourfavourite Haskell "aha" moment?)
>>
>>
>>
>> I'll answer this, since I have been teaching Haskell to children for six
>> years or so. :)
>>
>>
>>
>> I think it's important to distinguish between Haskell AS USED in most of
>> the community, and Haskell as it COULD be used.  I agree that you don't
>> want to teach the first of those to children.  But Haskell is still a great
>> teaching choice, mainly because GHC is so configurable that you can create
>> the environment you want, and just build it with a Haskell compiler.  With
>> GHC plugins, this is becoming even more true, but it already arises from a
>> combination of (a) very lightweight and intuitive core syntax in the first
>> place, (b) great support for custom preludes, and (c) the RebindableSyntax
>> extension, and the fact that so much syntax is defined in terms of
>> desugaring.
>>
>>
>>
>> If you're seriously talking about teaching children, then your concerns
>> about web frameworks and such are a bit silly.  (Unless by "children" you
>> meant mid to late teens and after, in which case this becomes relevant.)
>> "Advanced" type features are also not particularly relevant (though there's
>> some fuzziness about what counts as "advanced"; for instance, I've recently
>> decided it's better to teach GADT syntax as the only option for defining
>> algebraic data types, even though I never expect most students to take
>> advantage of the extra power of GADTs.)
>>
>>
>>
>> The main concern I have with F#, though, is that the semantics are far too
>> complex.  It has all the power of a functional language, but none of the
>> semantic simplicity. If students already struggle with compositional
>> programming (and they do), they struggle even more when the simplest way to
>> understand what's going on -- namely, substitution -- is taken away from
>> them.  If you're going to teach a computational model based on sequencing
>> actions on a global state (the state being the screen, network, etc.), then
>> you might as well include mutable variables in that global state, and you
>> might as well teach Python, which will at least be more intuitive, if not
>> simpler.
>>
>>
>>
>> On Thu, Jul 12, 2018 at 7:46 AM PY <[hidden email]> wrote:
>>
>> I am afraid that it can lead to flame again, but F# has super-capacity:
>> you can check measuring units, type providers, computation expressions,
>> active patterns, static/dynamic types constraints, constraints on existing
>> method, etc... It's clean, borrows some ideas from Haskell, some are
>> original and Haskell borrows them (but with worse implementation). IMHO for
>> children teaching to FP F# is the best. Even more, currently C# also has a
>> lot of FP features (
>> https://github.com/dotnet/csharplang/blob/master/proposals/patterns.md#arithmetic-simplification
>> -- is not it super easy and beauty?). Rust is more low level: you should
>> think about memory "management", OOP has some problems... And serious
>> argument for children teaching: salary trends (joke sure) :-) But you can
>> compare salary in F# and Haskell, for example - people often choice
>> language after check current salaries in the market. Also F# is more
>> focused on realistic tasks and business value. It lacks performance, UWP
>> yet (but in progress)... To feel how F# is sexy compare Web application
>> written in Websharper and in any Haskell framework. Haskell is beauty but
>> I'm afraid its fate unfortunately will be the same as one of Common Lisp,
>> NetBSD, etc - it's ground for ideas and experiments and has disputable
>> design. Also it's more-more difficult to teach children to Haskell than to
>> F#...
>>
>> IMHO is general to teach FP is more easy than to teach OOP if FP is not
>> Haskell (some language which targets more eager/efficient/dynamic/real
>> goals instead of abstract types playing).
>>
>> 12.07.2018 13:28, Vanessa McHale wrote:
>>
>> I wouldn't say Rust has a large capacity for FP. I am not familiar with
>>
>> F#. The thing that makes FP infeasible in Rust is not the lack of purity
>>
>> but rather the fact that affine types make it difficult to treat
>>
>> functions as first-class values.
>>
>>
>>
>>
>>
>> On 07/12/2018 01:40 AM, Brett Gilio wrote:
>>
>> Tony,
>>
>>
>>
>> I am curious on your attitude towards multi-paradigm and ML-like
>>
>> languages. I agree that functional programming is easily the better of
>>
>> the bundle in many forms of application logic and elegance (which is
>>
>> why I have come to love Scheme and Haskell), but do you see any room
>>
>> for those languages like F# or Rust which have large capacities for FP
>>
>> but are either functional-first (but not pure) or a hybrid?
>>
>>
>>
>> Brett Gilio
>>
>>
>>
>> On 07/12/2018 01:35 AM, Tony Morris wrote:
>>
>>   I used to teach undergrad OOP nonsense. I have been teaching FP for 15
>>
>> years. [^1]
>>
>>
>>
>> The latter is *way* easier. Existing programmers are more difficult than
>>
>> children, but still way easier to teach FP than all the other stuff.
>>
>>
>>
>> [^1]: Canberra anyone? https://qfpl.io/posts/2018-canberra-intro-to-fp/
>>
>>
>>
>>
>>
>> On 07/12/2018 04:23 PM, Joachim Durchholz wrote:
>>
>> Am 11.07.2018 um 16:36 schrieb Damian Nadales:
>>
>>
>>
>> I speak only from my own narrow perspective. I'd say programming is
>>
>> hard, but functional programming is harder.
>>
>>
>>
>> Actually it's pretty much the opposite, I hear from teachers.
>>
>>
>>
>> Maybe that's why Java replaced Haskell in some universities
>>
>> curricula
>>
>> The considerations are marketable skills.
>>
>> A considerable fraction of students is looking at the curriculum and
>>
>> at job offers, and if they find that the lists don't match, they will
>>
>> go to another university.
>>
>> Also, industry keeps lobbying for teaching skills that they can use.
>>
>> Industry can give money to universities so this gives them influence
>>
>> on the curriculum (and only if they get time to talk the topic over
>>
>> with the dean). This aspect can vary considerably between countries,
>>
>> depending on how much money the universities tend to acquire from
>>
>> industry.
>>
>>
>>
>> https://chrisdone.com/posts/dijkstra-haskell-java. For some reason
>>
>> most programmers I know are not scared of learning OO, but they fear
>>
>> functional programming.
>>
>>
>>
>> Programmers were *very* scared of OO in the nineties. It took roughly
>>
>> a decade or two (depending on where you put the starting point) to get
>>
>> comfortable with OO.
>>
>>
>>
>>
>>
>>    I think the reason might be that OO concepts
>>
>> like inheritance and passing messages between objects are a bit more
>>
>> concrete and easier to grasp (when you present toy examples at least).
>>
>>
>>
>> OO is about how to deal with having to pack everything into its own
>>
>> class (and how to arrange stuff into classes).
>>
>> Functional is about how to deal with the inability to update. Here,
>>
>> the functional camp actually has the easier job, because you can just
>>
>> tell people to just write code that creates new data objects and get
>>
>> over with it. Performance concerns can be handwaved away by saying
>>
>> that the compiler is hyper-aggressive, and "you can look at the
>>
>> intermediate code if you suspect the compiler is the issue".
>>
>> (Functional is a bit similar to SQL here, but the SQL optimizers are
>>
>> much less competent than GHC at detecting optimization opportunities.)
>>
>>
>>
>> Then you have design patterns, which have intuitive names and give
>>
>> some very general guidelines that one can try after reading them (and
>>
>> add his/her own personal twist). I doubt people can read the Monad
>>
>> laws and make any sense out of them at the first try.
>>
>>
>>
>> That's true, but much of the misconceptions around monads from the
>>
>> first days have been cleared up.
>>
>> But yes the monad laws are too hard to read. OTOH you won't be able to
>>
>> read the Tree code in the JDK without the explanations either.
>>
>> _______________________________________________
>>
>> 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.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>>
>> 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.
>>
>>
>>
>> _______________________________________________
>>
>> 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.
>>
>>
>>
>>
>>
>> _______________________________________________
>>
>> 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.
>>
>>
>>
>> _______________________________________________
>> 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.
>>
>>
>>
>>
>>
> _______________________________________________
> 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.

_______________________________________________
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.

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is your favourite Haskell "aha" moment?)

Tony Morris-4
In reply to this post by Brett Gilio
Hi Brett,
I see room for other languages, with other potential paradigms, but of
all those implementations that I know of, I have never seen anything
with a practical result. They all fall for the Fallacy of False
Moderation in my opinion. Perhaps this makes me a hardliner, but until
something more useful comes along, it's going to have to stay that way.
The code I am writing at this very moment cannot even exist in F# or Rust.

PS: I thought I had already sent this, sorry.


On 07/12/2018 04:40 PM, Brett Gilio wrote:

> Tony,
>
> I am curious on your attitude towards multi-paradigm and ML-like
> languages. I agree that functional programming is easily the better of
> the bundle in many forms of application logic and elegance (which is
> why I have come to love Scheme and Haskell), but do you see any room
> for those languages like F# or Rust which have large capacities for FP
> but are either functional-first (but not pure) or a hybrid?
>
> Brett Gilio
>
> On 07/12/2018 01:35 AM, Tony Morris wrote:
>>   I used to teach undergrad OOP nonsense. I have been teaching FP for 15
>> years. [^1]
>>
>> The latter is *way* easier. Existing programmers are more difficult than
>> children, but still way easier to teach FP than all the other stuff.
>>
>> [^1]: Canberra anyone? https://qfpl.io/posts/2018-canberra-intro-to-fp/
>>
>>
>> On 07/12/2018 04:23 PM, Joachim Durchholz wrote:
>>> Am 11.07.2018 um 16:36 schrieb Damian Nadales:
>>>>
>>>> I speak only from my own narrow perspective. I'd say programming is
>>>> hard, but functional programming is harder.
>>>
>>> Actually it's pretty much the opposite, I hear from teachers.
>>>
>>>> Maybe that's why Java replaced Haskell in some universities
>>>> curricula
>>> The considerations are marketable skills.
>>> A considerable fraction of students is looking at the curriculum and
>>> at job offers, and if they find that the lists don't match, they will
>>> go to another university.
>>> Also, industry keeps lobbying for teaching skills that they can use.
>>> Industry can give money to universities so this gives them influence
>>> on the curriculum (and only if they get time to talk the topic over
>>> with the dean). This aspect can vary considerably between countries,
>>> depending on how much money the universities tend to acquire from
>>> industry.
>>>
>>>> https://chrisdone.com/posts/dijkstra-haskell-java. For some reason
>>>> most programmers I know are not scared of learning OO, but they fear
>>>> functional programming.
>>>
>>> Programmers were *very* scared of OO in the nineties. It took roughly
>>> a decade or two (depending on where you put the starting point) to get
>>> comfortable with OO.
>>>
>>>>
>>>    I think the reason might be that OO concepts
>>>> like inheritance and passing messages between objects are a bit more
>>>> concrete and easier to grasp (when you present toy examples at least).
>>>
>>> OO is about how to deal with having to pack everything into its own
>>> class (and how to arrange stuff into classes).
>>> Functional is about how to deal with the inability to update. Here,
>>> the functional camp actually has the easier job, because you can just
>>> tell people to just write code that creates new data objects and get
>>> over with it. Performance concerns can be handwaved away by saying
>>> that the compiler is hyper-aggressive, and "you can look at the
>>> intermediate code if you suspect the compiler is the issue".
>>> (Functional is a bit similar to SQL here, but the SQL optimizers are
>>> much less competent than GHC at detecting optimization opportunities.)
>>>
>>>> Then you have design patterns, which have intuitive names and give
>>>> some very general guidelines that one can try after reading them (and
>>>> add his/her own personal twist). I doubt people can read the Monad
>>>> laws and make any sense out of them at the first try.
>>>
>>> That's true, but much of the misconceptions around monads from the
>>> first days have been cleared up.
>>> But yes the monad laws are too hard to read. OTOH you won't be able to
>>> read the Tree code in the JDK without the explanations either.
>>> _______________________________________________
>>> 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.
>>
>>
>>
>>
>> _______________________________________________
>> 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.
>>
> _______________________________________________
> 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.


_______________________________________________
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.

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: What is your favourite Haskell "aha" moment?

Tony Morris-4
In reply to this post by Brett Gilio
On python, we are fixing it (WIP):
https://github.com/qfpl/hpython

Did you see the recent "default mutable arguments" post?
https://lethain.com/digg-v4/

Here is a Haskell program that transforms any python program that uses
default mutable arguments:
https://github.com/qfpl/hpython/blob/master/example/FixMutableDefaultArguments.hs

Someone once said that python will never have tail call optimisation.
Here is the Haskell program that transforms any Python (direct only)
tail call into a loop:
https://github.com/qfpl/hpython/blob/master/example/OptimizeTailRecursion.hs

Two python programmers once argued over preferred indentation levels.
Let's put their disagreement into a Haskell function so that they can
stop arguing:
https://github.com/qfpl/hpython/blob/master/example/Indentation.hs


On 07/12/2018 07:58 PM, Brett Gilio wrote:

> Python is poison, indeed. ;)
>
> Brett Gilio
> [hidden email] | [hidden email]
> Free Software -- Free Society!
>
> On 07/12/2018 04:56 AM, Graham Klyne wrote:
>> Although I don't program regularly in Haskell these days (my poison
>> is Python, mainly for Web framework support), I do occasionally find
>> myself coding tricky manipulations in Haskell first as I find it
>> easier to concentrate on the essentials of an algorithm.  Once I have
>> the Haskell code written and tested, I generally find it fairly easy
>> to map the algorithm into Python (using higher order functions as
>> appropriate).
>>
>> Here are some examples:
>>
>> https://github.com/gklyne/annalist/blob/master/spike/rearrange-list/move_up.lhs
>>
>> https://github.com/gklyne/annalist/blob/master/spike/tree-scan/tree_scan.lhs
>>
>>
>> And the corresponding code in the actual application:
>>
>> https://github.com/gklyne/annalist/blob/4d21250a3457c72d4f6525e5a4fac40d4c0ca1c8/src/annalist_root/annalist/views/entityedit.py#L2489
>>
>>
>> https://github.com/gklyne/annalist/blob/master/src/annalist_root/annalist/models/entity.py#L245
>>
>>
>> #g
>> -- 
>>
>>
>> On 11/07/2018 13:10, Simon Peyton Jones via Haskell-Cafe wrote:
>>> Friends
>>> In a few weeks I'm giving a talk to a bunch of genomics folk at the
>>> Sanger Institute<https://www.sanger.ac.uk/> about Haskell.   They do
>>> lots of programming, but they aren't computer scientists.
>>> I can tell them plenty about Haskell, but I'm ill-equipped to answer
>>> the main question in their minds: why should I even care about
>>> Haskell?  I'm too much of a biased witness.
>>>
>>> So I thought I'd ask you for help.  War stories perhaps - how using
>>> Haskell worked (or didn't) for you.  But rather than talk
>>> generalities, I'd love to illustrate with copious examples of
>>> beautiful code.
>>>
>>>    *   Can you identify a few lines of Haskell that best
>>> characterise what you think makes Haskell distinctively worth caring
>>> about?   Something that gave you an "aha" moment, or that feeling of
>>> joy when you truly make sense of something for the first time.
>>> The challenge is, of course, that this audience will know no
>>> Haskell, so muttering about Cartesian Closed Categories isn't going
>>> to do it for them.  I need examples that I can present in 5 minutes,
>>> without needing a long setup.
>>> To take a very basic example, consider Quicksort using list
>>> comprehensions, compared with its equivalent in C.  It's so short,
>>> so obviously right, whereas doing the right thing with in-place
>>> update in C notoriously prone to fencepost errors etc.  But it also
>>> makes much less good use of memory, and is likely to run slower.  I
>>> think I can do that in 5 minutes.
>>> Another thing that I think comes over easily is the ability to
>>> abstract: generalising sum and product to fold by abstracting out a
>>> functional argument; generalising at the type level by polymorphism,
>>> including polymorphism over higher-kinded type constructors.   Maybe
>>> 8 minutes.
>>> But you will have more and better ideas, and (crucially) ideas that
>>> are more credibly grounded in the day to day reality of writing
>>> programs that get work done.
>>> Pointers to your favourite blog posts would be another avenue.  (I
>>> love the Haskell Weekly News.)
>>> Finally, I know that some of you use Haskell specifically for
>>> genomics work, and maybe some of your insights would be particularly
>>> relevant for the Sanger audience.
>>> Thank you!  Perhaps your responses on this thread (if any) may be
>>> helpful to more than just me.
>>> Simon
>>>
>>>
>>>
>>> _______________________________________________
>>> 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.
>>>
>> _______________________________________________
>> 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.
> _______________________________________________
> 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.


_______________________________________________
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.

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is your favourite Haskell "aha" moment?)

Brett Gilio
In reply to this post by Tony Morris-4
On 07/12/2018 06:36 PM, Tony Morris wrote:
> Hi Brett,
> I see room for other languages, with other potential paradigms, but of
> all those implementations that I know of, I have never seen anything
> with a practical result.

I agree with your thesis here, the facts are pretty clear that even in
multi-paradigm approach there is still a clearer and more elegant way to
approach the programmatic logic. My interest in F# and other more
"multi-paradigm" languages (even C++, nowadays) came to a... shall we
say, bridge point when I discovered the power of Scheme
implemementations and Haskell/Idris.

> PS: I thought I had already sent this, sorry.

You had, it was my mistake that I responded off of the list.


--
Brett Gilio
[hidden email] | [hidden email]
Free Software -- Free Society!
_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is your favourite Haskell "aha" moment?)

Brett Gilio
In reply to this post by Paul
On 07/12/2018 06:46 AM, PY wrote:
  written in Websharper and in any Haskell framework. Haskell is beauty
> but I'm afraid its fate unfortunately will be the same as one of Common
> Lisp, NetBSD, etc - it's ground for ideas and experiments and has
> disputable design. Also it's more-more difficult to teach children to
> Haskell than to F#...
>

I wonder if this is simply a result of the marketing of the language,
itself, rather than the strength of the language. I agree, F# has a lot
of beauty, but there remain many things that Haskell has a leg up on
that F# lacks, like dependent types.


--
Brett Gilio
[hidden email] | [hidden email]
Free Software -- Free Society!
_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: What is your favourite Haskell "aha" moment?

Brett Gilio
In reply to this post by Alexey Raga
On 07/12/2018 09:04 AM, Alexey Raga wrote:
> Another thing is that sometimes I'd just play "Type Tetris" to make
> things compile and work. Try something, the compiler says "No, can't
> have this", perhaps make a suggestion, try another thing, "aha, next
> step", etc. Learned so much from these "games" :)

Ha! I like your approach. Thank you for your explanation.


--
Brett Gilio
[hidden email] | [hidden email]
Free Software -- Free Society!
_______________________________________________
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.
Reply | Threaded
Open this post in threaded view
|

Re: What is your favourite Haskell "aha" moment?

Vanessa McHale
In reply to this post by Haskell - Haskell-Cafe mailing list

Oh, and this may not be appropriate for your particular audience, but I definitely like the fact that you can write some algorithms extremely elegantly with recursion schemes, viz.

import Data.Functor.Foldable import Data.Ratio (Ratio, denominator, (%))

isInteger :: (RealFrac a) => a -> Bool isInteger = idem (realToFrac . floor) where idem = ((==) <*>)

continuedFraction :: (RealFrac a, Integral b) => a -> [b] continuedFraction = apo coalgebra where coalgebra x | isInteger x = go $ Left [] | otherwise = go $ Right alpha where alpha = 1 / (x - realToFrac (floor x)) go = Cons (floor x)


I wrote up a whole bunch of examples here: http://blog.vmchale.com/article/recursion-examples

I think such examples are really great because they are things which are not possible in Rust (or F#, if I am not mistaken).

On 07/11/2018 07:10 AM, Simon Peyton Jones via Haskell-Cafe wrote:

Friends

In a few weeks I’m giving a talk to a bunch of genomics folk at the Sanger Institute about Haskell.   They do lots of programming, but they aren’t computer scientists.

I can tell them plenty about Haskell, but I’m ill-equipped to answer the main question in their minds: why should I even care about Haskell?  I’m too much of a biased witness.

So I thought I’d ask you for help.  War stories perhaps – how using Haskell worked (or didn’t) for you.  But rather than talk generalities, I’d love to illustrate with copious examples of beautiful code.

  • Can you identify a few lines of Haskell that best characterise what you think makes Haskell distinctively worth caring about?   Something that gave you an “aha” moment, or that feeling of joy when you truly make sense of something for the first time.

The challenge is, of course, that this audience will know no Haskell, so muttering about Cartesian Closed Categories isn’t going to do it for them.  I need examples that I can present in 5 minutes, without needing a long setup.

To take a very basic example, consider Quicksort using list comprehensions, compared with its equivalent in C.  It’s so short, so obviously right, whereas doing the right thing with in-place update in C notoriously prone to fencepost errors etc.  But it also makes much less good use of memory, and is likely to run slower.  I think I can do that in 5 minutes.

Another thing that I think comes over easily is the ability to abstract: generalising sum and product to fold by abstracting out a functional argument; generalising at the type level by polymorphism, including polymorphism over higher-kinded type constructors.   Maybe 8 minutes.

But you will have more and better ideas, and (crucially) ideas that are more credibly grounded in the day to day reality of writing programs that get work done.

Pointers to your favourite blog posts would be another avenue.  (I love the Haskell Weekly News.)

Finally, I know that some of you use Haskell specifically for genomics work, and maybe some of your insights would be particularly relevant for the Sanger audience.

Thank you!  Perhaps your responses on this thread (if any) may be helpful to more than just me.

Simon



_______________________________________________
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.

_______________________________________________
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.

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Investing in languages (Was: What is your favourite Haskell "aha" moment?)

Joachim Durchholz
In reply to this post by Sergiu Ivanov-2
Am 12.07.2018 um 23:25 schrieb Sergiu Ivanov:

> Hello Chris,
>
> Thus quoth  Chris Smith  on Thu Jul 12 2018 at 22:48 (+0200):
>> I've seen plenty of students as old as 12 to 13 who literally cannot
>> see whether there's a comma in an expression, or whether a word is
>> spelled "ie" or "ei", without extreme measures like covering the
>> surrounding text.
>
> This sounds a lot like symptoms of dyslexia.  Are you talking about
> students _without_ such disorders?
Of course they are dyslexic - it's defined as having lower reading
capabilities than their peers.

It doesn't matter much. Most children catch up on their reading
capabilities, or they learn to cope.
And IQ is not correlated to reading (or writing) ability, so it is
useful to introduce them to the field if possible.
Even IQ isn't too relevant to the ability to code. IQ measures a whole
lot of pretty unrelated things, and while the ability to code and IQ are
correlated, they are not 1:1.

Regards,
Jo
_______________________________________________
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.
123456