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. How to build a package? (John M. Dlugosz)
2. Re: How would you write... (Kim-Ee Yeoh)
3. why do classes require the type variable in type signatures?
(Dimitri DeFigueiredo)
4. Re: why do classes require the type variable in type
signatures? (Andres L?h)
----------------------------------------------------------------------
Message: 1
Date: Tue, 22 Apr 2014 13:52:04 -0500
From: "John M. Dlugosz" <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] How to build a package?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
I used cabal unpack to get the source of a package to read. Now I want to make
a change.
How do I tell Haskell Platform to make that (the same way cabal knows how to)
and do so
with the provided files rather than downloading into temp.
I got a package to work before using Leksah, but I'd like to do it directly
since the
cabal file is present and works just fine.
A related issue: what should I do about the local copy of a module name that is
also
installed? Can I make my project use that instead, without having to globally
change the
name in all the files?
------------------------------
Message: 2
Date: Wed, 23 Apr 2014 10:09:56 +0700
From: Kim-Ee Yeoh <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How would you write...
Message-ID:
<capy+zdszaaqhwoannk9cgsxos5imjpoqabsd5jx7u3ge9dw...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
On Wed, Apr 23, 2014 at 1:37 AM, John M. Dlugosz
<[email protected]>wrote:
> I didn't realize that using real words from a library instead of foo and
> bar was considered unfriendly!
As everyone else has chimed in, signatures + succinct description is a
minimum.
Haskell usage is very, very diverse. You can't assume that everyone knows
the specifics of a library you're using.
E.g. graphics usage is scattered all over the place. Many (most?)
haskellers hardly meddle with graphics in the slightest.
-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140423/0905c40c/attachment-0001.html>
------------------------------
Message: 3
Date: Wed, 23 Apr 2014 02:23:33 -0600
From: Dimitri DeFigueiredo <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] why do classes require the type variable
in type signatures?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hello All,
Why does this compile
class Special a where
isSpecial :: a -> Bool
whereas, GHC 7.6 complains about this
class AlsoSpecial a where
isAlsoSpecial :: b -> Bool
This is the error message I get:
The class method `isAlsoSpecial'
mentions none of the type variables of the class AlsoSpecial a
When checking the class method:
isAlsoSpecial :: forall b. b -> Bool
In the class declaration for `AlsoSpecial'
My question is: Why must I use the type variable of the class
declaration (i.e. *a*) in the type signature for the associated method?
Is there a fundamental reason for this or is it just a GHC specific
limitation? I didn't see a need for it when watching this video
http://channel9.msdn.com/posts/MDCC-TechTalk-Classes-Jim-but-not-as-we-know-them
that explains the translation that GHC does to turn type classes into core.
Thanks!
Dimitri
------------------------------
Message: 4
Date: Wed, 23 Apr 2014 10:35:39 +0200
From: Andres L?h <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] why do classes require the type
variable in type signatures?
Message-ID:
<caljd_v74ua9xvpyvhallu-urgt82axexbezfqrntu40gl3c...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
If you have a class like this
> class AlsoSpecial a where
> isAlsoSpecial :: b -> Bool
then 'isAlsoSpecial' would get a type like this
isAlsoSpecial :: AlsoSpecial a => b -> Bool
There may be several instances of class 'AlsoSpecial' with different
implementations. GHC has the task of figuring out which of the
implementations to use in a specific situation. It does so by looking
at the context in which it is used. But if, like here, the type itself
does not mention the class variable, then learning about the context
won't help. For example, if we use the function like this
isAlsoSpecial 'x'
then GHC learns that 'b' must be a 'Char', but it still does not know
anything about 'a'. In fact, there's absolutely no way to establish
information about 'a' at all. This is the problem, and this is why the
class method is rejected in the first place.
(The translation to Core is still possible. In Core itself, every type
application is explicit, so in Core there'd be a syntax to manually
resolve the ambiguity by explicitly selecting which 'a' we want to use
and passing the appropriate dictionary. But Haskell's surface language
doesn't provide this option, and it never has.)
Cheers,
Andres
--
Andres L?h, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com
Registered in England & Wales, OC335890
250 Ice Wharf, 17 New Wharf Road, London N1 9RF, England
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 70, Issue 45
*****************************************