Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: vim - quickly take suggestions from ghc, in case of
compile errors (Rene@gmail)
2. Evaluation Order Semantics (Mike Meyer)
3. Re: How to understand the type "ShowS"? (yi lu)
4. Re: How to understand the type "ShowS"? (Lyndon Maydwell)
----------------------------------------------------------------------
Message: 1
Date: Tue, 24 Sep 2013 17:19:25 +0200
From: "Rene@gmail" <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] vim - quickly take suggestions from
ghc, in case of compile errors
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
Hi Nathan,
try ghc-mod (cabal install ...) and syntastic
(https://github.com/scrooloose/syntastic/).
cheers,
Ren?
On 24.09.2013 16:30, [email protected] wrote:
> Message: 4
> Date: Tue, 24 Sep 2013 16:08:24 +0200
> From: Nathan H?sken <[email protected]>
> To: Haskell Beginners Mailinglist <[email protected]>
> Subject: [Haskell-beginners] vim - quickly take suggestions from ghc
> in case of compile errors
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hey,
>
> ghc has a nice feature, when one compiles a haskell program and has made
> a spelling error, it suggest similar names that could be what one meant.
>
> Example:
> Data.hs:24:44:
> Not in scope: `mont_'
> Perhaps you meant `month_' (line 10)
>
> Is there a vim plugin that takes advantage of this? So that I can
> compile my haskell project, and for errors where ghc has a suggestion
> insert the suggestion with a simple key press?
>
> Thanks!
> Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130924/0aab6f00/attachment-0001.html>
------------------------------
Message: 2
Date: Tue, 24 Sep 2013 15:10:54 -0500
From: Mike Meyer <[email protected]>
To: [email protected], [email protected]
Subject: [Haskell-beginners] Evaluation Order Semantics
Message-ID:
<CAD272pBpzUAP=gxksj9elkjpu_r73jzclihedlqyyd+_9za...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
>
>
> Date: Tue, 24 Sep 2013 12:01:51 +0800
> From: ??? <[email protected]>
>
> Yes, if the spec does not state the evaluation order I can't predict the
> performance definitely.
>
Well, depending on how definite you want to be, an inability to predict the
performance definitely is inherent in using compiled languages. That the
performance can change if you change the compilation options shows that. On
the other end of the scale, if you correctly implement an O(n) algorithm,
then it's definitely going to take at most O(n) steps to print the results
from it whether the language is strict or lazy.
Being more definite does get harder in the face of lazy evaluation, but it
also gets harder in the face of optimization. A lazy language will not
evaluate expressions whose value is never used. So will a good optimizing
compiler for a strict language.
Can you be a bit more explicit in what about performance you're trying to
predict?
Note to Keshav - yes, evaluating expressions you don't have to can change
the results. But I was talking about the evaluation order for expressions
you actually evaluate, though maybe I wasn't clear about it. Thanks for
pointing that out, though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130924/4813db0c/attachment-0001.html>
------------------------------
Message: 3
Date: Wed, 25 Sep 2013 08:15:34 +0800
From: yi lu <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How to understand the type "ShowS"?
Message-ID:
<cakcmqqxvsxysmasyfdezhsxzqwsuhfapt3qkh3tbbzf_v4-...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
to @Kim-Ee
I find it here. Thanks again.
http://learnyouahaskell.com/for-a-few-monads-more
On Tue, Sep 24, 2013 at 8:36 PM, yi lu <[email protected]>wrote:
>
>
>
> On Tue, Sep 24, 2013 at 7:50 PM, Kim-Ee Yeoh <[email protected]> wrote:
>
>>
>> On Tue, Sep 24, 2013 at 6:43 PM, yi lu <[email protected]>wrote:
>>
>>> I have just looked at the API of Prelude, and I remember similar
>>> definition for parallel haskell.
>>
>>
>> How far have you gotten with LYAH? Or Hutton's textbook?
>>
>> I don't know this problem is revealed in LYAH, and I will check it now.
> Thanks.
>
>
>> What does a search on "haskell intro type system" reveal?
>>
>> -- Kim-Ee
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130925/7045f65d/attachment-0001.html>
------------------------------
Message: 4
Date: Wed, 25 Sep 2013 14:58:40 +1000
From: Lyndon Maydwell <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How to understand the type "ShowS"?
Message-ID:
<CAM5QZtwKsj+Lpadwts=dt7_s6nrxxwnvmxc1hw3qmsy6mzz...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Although the links (difflist, for-a-few-monads-more) that you posted are
very interesting in their own right, you only need to understand the
following in order to comprehend "shows" and "ShowS"...
* Type-Classes
* Type Synonyms
* Partial Application
* Function Composition
Type Classes
==========
There are many references for understanding how these work, but the "shows"
function simply depends on its first parameter being able to be shown
through the use of the "Show" type-class.
Type Synonyms
============
Any type can have an "alias" created in the form of a type-synonym.
Although these can be parameterised, in the case of "ShowS" it is not:
`type ShowS = String -> String`
This means that wherever you see a reference to "ShowS" in a type, you may
replace it with "String -> String".
Partial application
=============
Look at a reference implementation of "shows" that Shrivats has described:
`shows x s = show x ++ s`
The type signature of "shows" focuses on the partially applied viewpoint,
because (thanks to the type-synonym) it is written as if it only takes one
argument:
`shows :: Show a => a -> ShowS`
However, with the "ShowS" synonym resolved, you can see that it actually
takes two:
`shows :: Show a => a -> String -> String`
Keep in mind that although Shrivats implementation is semantically
equivalent to the one in GHC.List, the performance characteristics may be
different.
Function Composition
================
Although this isn't strictly required in order to understand "shows", it
provides a potential motivation for why the function exists.
If you wished to chain together a bunch of String representations of
various objects, leaving the possibility of adding more later, you would
have to use many lambdas if you wished to constrain yourself to using
"show" and "++". For example:
`showWithMore a = \x -> show a ++ x`
Applying these would become tedious:
`myBools = \x -> showWithMore True (showWithMore False x)`
Thankfully, this can be avoided through the use of function-composition:
``myBools = shows True . shows False`
Hopefully this goes some way to getting you to the core of the construction
and motivation of these functions and synonyms.
As always, for a true understanding of the motivations behind such a
function, nothing beats looking at the source code [1].
[1] -
http://hackage.haskell.org/packages/archive/base/3.0.3.2/doc/html/src/GHC-Show.html#ShowS
On Wed, Sep 25, 2013 at 10:15 AM, yi lu <[email protected]>wrote:
> to @Kim-Ee
>
> I find it here. Thanks again.
> http://learnyouahaskell.com/for-a-few-monads-more
>
>
>
> On Tue, Sep 24, 2013 at 8:36 PM, yi lu <[email protected]>wrote:
>
>>
>>
>>
>> On Tue, Sep 24, 2013 at 7:50 PM, Kim-Ee Yeoh <[email protected]> wrote:
>>
>>>
>>> On Tue, Sep 24, 2013 at 6:43 PM, yi lu <[email protected]>wrote:
>>>
>>>> I have just looked at the API of Prelude, and I remember similar
>>>> definition for parallel haskell.
>>>
>>>
>>> How far have you gotten with LYAH? Or Hutton's textbook?
>>>
>>> I don't know this problem is revealed in LYAH, and I will check it now.
>> Thanks.
>>
>>
>>> What does a search on "haskell intro type system" reveal?
>>>
>>> -- Kim-Ee
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> [email protected]
>>> http://www.haskell.org/mailman/listinfo/beginners
>>>
>>>
>>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130925/aef01171/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 63, Issue 38
*****************************************