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: Ambiguous type variables (Brent Yorgey)
2. Re: Ambiguous type variables (Kim-Ee Yeoh)
3. Re: Ambiguous type variables (Dennis Raddle)
4. cabal install (Gilberto Melfe)
5. Re: cabal install (Andres L?h)
6. emacs + ghc-mod + cabal repl (Miguel Negr?o)
----------------------------------------------------------------------
Message: 1
Date: Mon, 17 Mar 2014 16:02:21 -0400
From: Brent Yorgey <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Ambiguous type variables
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Mon, Mar 17, 2014 at 12:14:31PM -0700, Dennis Raddle wrote:
>
> The error is
>
> Ambiguous type variables 'd0', 'c0' in the constraint:
> (Bt d0 c0 memo) arising from a use of 'newMemo'
>
> class Bt d c memo | d -> c, d -> memo where
>
> newMemo :: memo
This is because given a use of 'newMemo', the compiler will be able to
infer the type 'memo' from the context in which it is used, but there
is no way for it to infer the types d and c. Hence they are
ambiguous. There could be overlapping instances like
instance Bt Int Int Char ...
instance Bt Bool String Char ...
so knowing memo=Char does not tell us what d and c are. (Note the
compiler still refuses to make a choice even if there is only one
matching instance in scope, because new instances could always be
added in another module.)
I can think of several possible solutions:
1. Add some functional dependencies memo -> d, memo -> c. This
would "solve" the error though it is probably not what you want.
2. Add some 'dummy' arguments to newMemo (and other functions with a
similar problem), like
newMemo :: Proxy d -> memo
However, this is a bit annoying to call since it requires giving
a Proxy argument with a type signature.
3. Make Bt a record rather than a type class. This might actually
be your best bet. You have to manually pass around Bt records,
but you get to fully specify the types involved.
-Brent
------------------------------
Message: 2
Date: Tue, 18 Mar 2014 03:28:59 +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] Ambiguous type variables
Message-ID:
<CAPY+ZdQRHw2VC=FLBdux4K=x8KkApnwA-0ervCua3yXLh1S=_...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
On Tue, Mar 18, 2014 at 2:14 AM, Dennis Raddle <[email protected]>wrote:
> class Bt d c memo | d -> c, d -> memo where
Could you also say something about the instances you intend to implement
for this typeclass?
If there's only 1, which the statement of the problem suggests as much, you
can dispense of the typeclass entirely and just work with plain functions!
Could be that you want something working first and generalize /
polymorphize later.
-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140318/de549ebc/attachment-0001.html>
------------------------------
Message: 3
Date: Mon, 17 Mar 2014 15:56:05 -0700
From: Dennis Raddle <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Ambiguous type variables
Message-ID:
<cakxlvorxchsb6fhs4p6pntot-jcb36j7uoeulefucgab04i...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
On Mon, Mar 17, 2014 at 1:28 PM, Kim-Ee Yeoh <[email protected]> wrote:
>
> On Tue, Mar 18, 2014 at 2:14 AM, Dennis Raddle <[email protected]>wrote:
>
>> class Bt d c memo | d -> c, d -> memo where
>
>
> Could you also say something about the instances you intend to implement
> for this typeclass?
>
> If there's only 1, which the statement of the problem suggests as much,
> you can dispense of the typeclass entirely and just work with plain
> functions!
>
> Could be that you want something working first and generalize /
> polymorphize later.
>
I don't know yet how I want to represent the solution being searched for;
i.e. I don't know how I want to represent musical structures, and I need
the freedom to try different ones without rewriting my code. I also wanted
to implement a few toy problems to do testing on my algorithm.
But, you are absolutely right that I am generalizing too quickly. I worked
on a toy problem today and had several insights. I noticed that some
problems have specifics that don't fit the same mold.
-Dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140317/d958b79d/attachment-0001.html>
------------------------------
Message: 4
Date: Tue, 18 Mar 2014 09:46:42 +0000
From: Gilberto Melfe <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] cabal install
Message-ID:
<CAH5k6k4U=9NBbEy_8z-yMX-qWd5EEg-gE6PzOM-ORC=mxeb...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Good morning, Good people of the haskell community!
I need to develop a web(site)/application. I want to try using Yesod.
First thing i need to install it. (I already have the haskell-platform)
So I run:
cabal update
It tells me that a new version of cabal-install is available; then I run:
cabal install cabal-install
After doing whatever it wants to do, successfully (at least that's what I
think the logs say; I didn't notice any error) I update my path to:
export PATH=/home/.../.cabal/bin:$PATH
Everything is "OK" now! But I still don't have a cabal-install binary, and
this update has been performed only for me (inside my user account)!
Shouldn't I have a binary cabal-install to run?
How can I update globally? (for all users of the system!)
After this I'm going to try to install Yesod! And of course I would like to
install for all users of the system (yes I'm the only one:-) but I'm just
asking...)
Can anyone help me out?
Thank You very much!
Gilberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140318/de8fcdda/attachment-0001.html>
------------------------------
Message: 5
Date: Tue, 18 Mar 2014 11:54:21 +0100
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] cabal install
Message-ID:
<caljd_v5ds7kcrvrnqareycqubhgjhu_m_yd80_leufweglr...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Hi.
> After doing whatever it wants to do, successfully (at least that's what I
> think the logs say; I didn't notice any error) I update my path to:
> export PATH=/home/.../.cabal/bin:$PATH
>
> Everything is "OK" now! But I still don't have a cabal-install binary, and
> this update has been performed only for me (inside my user account)!
>
> Shouldn't I have a binary cabal-install to run?
The binary is called "cabal", not "cabal-install". You should be able
to check whether the new version is being used by saying "cabal
--version".
> How can I update globally? (for all users of the system!)
By saying something like "sudo cabal install --global cabal-install".
Cheers,
Andres
------------------------------
Message: 6
Date: Tue, 18 Mar 2014 11:53:42 +0000
From: Miguel Negr?o <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] emacs + ghc-mod + cabal repl
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Hi
Can anyone tell me how switch from using ghci to cabal repl in emacs
with ghc-mod ? I would like to use emacs with cabal projects with
sandboxes, where ghci will not load the right packages.
best,
--
Miguel Negr?o
http://www.friendlyvirus.org/miguelnegrao
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 555 bytes
Desc: OpenPGP digital signature
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140318/81d18c5f/attachment-0001.sig>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 69, Issue 23
*****************************************