[Haskell-cafe] Language complexity & beginners (Was: New type of ($) operator in GHC 8.0 is problematic)

Artyom yom at artyom.me
Sat Feb 6 00:47:43 UTC 2016

I’ve amended my suggestion to say basically “this type is a slight lie, 
here’s a flag/command to see the true type” – this way we aren’t scaring 
people with implementation guts, merely letting them see the guts for 
themselves and then think “I don’t care about this” (which is, I think, 
exactly what should happen; the worst scenario here is that the beginner 
falls into the “I’m an advanced user, I need all features, I need to 
know everything, so I’ll enable the flag” trap – which is why it’s 
important not to call it “an advanced type” or mention “if you know what 
you’re doing” or anything else like that).

I don’t agree that levity can be compared to Java’s “class” or “static” 
– not because it’s harder to understand, but because it’s much less 
widely used; I don’t feel that you need to know about levity in order to 
be a good Haskeller. Also, unboxed types don’t imply knowledge of levity 
– for instance, I’ve been successfully using unboxed types for a while, 
but I only found out about the true type of |($)| by complete accident 
(I think I queried the kind of |->| and then got curious about question 
marks). Of

On 02/06/2016 03:27 AM, Mihai Maruseac wrote:

> On Fri, Feb 5, 2016 at 7:09 PM, Richard Eisenberg <eir at cis.upenn.edu> wrote:
>> Another great question that has come up is about Haddock output (Hackage). I
>> think Haddock needs to add a facility where library authors can include
>> specializations of an overly general type. This can be done in commentary,
>> but it's not as prominent. Such a new feature would address the ($) problem,
>> as ($) :: forall (a :: *) (b :: *). (a -> b) -> a -> b is a specialization
>> of its real type. It would also help a great deal with FTP-related
>> generalizations.
> This goes hand in hand with Artyom's suggestion of a warning in GHCi
> after showing the simpler type.
> I'm thinking of a flag which enables/disables printing the simplest
> type with warning (in GHCi) or footnote (or otherwise, in Haddock). We
> can have the default behavior of the flag be either printing the
> simpler type + extra (warning/footnote) or printing the longer type
> and include a reference in our learning materials that beginners and
> people confused by the long, complex and real type, can use
> --use-simpler-types flag.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160206/8fdca356/attachment.html>

More information about the Haskell-Cafe mailing list