Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/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: Data.Vector in Haskell (Brandon Allbery)
2. Re: Data.Vector in Haskell (Christopher Allen)
3. Can't figure out my error here (Barry DeZonia)
4. Re: Can't figure out my error here (Mike Meyer)
5. Re: Can't figure out my error here
(Sumit Sahrawat, Maths & Computing, IIT (BHU))
----------------------------------------------------------------------
Message: 1
Date: Thu, 28 May 2015 17:01:54 -0400
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Data.Vector in Haskell
Message-ID:
<CAKFCL4UJ1+UuQwrUeNe1AbevZVG=_akjvuryasxmaa6+hmy...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Wed, May 27, 2015 at 4:15 AM, Dananji Liyanage <[email protected]> wrote:
> <interactive>:41:18:
> Couldn't match expected type ?Data.Vector.Vector a?
> with actual type ?vector-0.10.9.1:Data.Vector.Vector Int?
> NB: ?Data.Vector.Vector?
> is defined in ?Data.Vector? in package ?vector-0.10.12.3?
> ?vector-0.10.9.1:Data.Vector.Vector?
> is defined in ?Data.Vector? in package ?vector-0.10.9.1?
>
Did you read the message? It is telling you that you have two versions of
the vector package installed, and it is unable to reconcile them.
You should likely remove one of them --- and in the future use sandboxes so
that you can avoid this kind of conflict.
--
brandon s allbery kf8nh sine nomine associates
[email protected] [email protected]
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150528/5f48e1f1/attachment-0001.html>
------------------------------
Message: 2
Date: Thu, 28 May 2015 16:03:42 -0500
From: Christopher Allen <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Data.Vector in Haskell
Message-ID:
<cadnndor7djgdaiagkpd99wci8zjtwzknh7kstgstzduhc2a...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
To that end, I've got an example for firing up a little Cabal project and
using a sandbox for the dependencies here:
http://howistart.org/posts/haskell/1
The short version:
mkdir project && cd project && cabal sandbox init && cabal install vector
&& cabal repl
Hope this helps,
Chris
On Thu, May 28, 2015 at 4:01 PM, Brandon Allbery <[email protected]>
wrote:
> On Wed, May 27, 2015 at 4:15 AM, Dananji Liyanage <[email protected]>
> wrote:
>
>> <interactive>:41:18:
>> Couldn't match expected type ?Data.Vector.Vector a?
>> with actual type ?vector-0.10.9.1:Data.Vector.Vector Int?
>> NB: ?Data.Vector.Vector?
>> is defined in ?Data.Vector? in package ?vector-0.10.12.3?
>> ?vector-0.10.9.1:Data.Vector.Vector?
>> is defined in ?Data.Vector? in package ?vector-0.10.9.1?
>>
>
> Did you read the message? It is telling you that you have two versions of
> the vector package installed, and it is unable to reconcile them.
>
> You should likely remove one of them --- and in the future use sandboxes
> so that you can avoid this kind of conflict.
>
> --
> brandon s allbery kf8nh sine nomine
> associates
> [email protected]
> [email protected]
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150528/dc063415/attachment-0001.html>
------------------------------
Message: 3
Date: Mon, 25 May 2015 12:42:35 -0500
From: Barry DeZonia <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Can't figure out my error here
Message-ID:
<cakcvfuteycqp6ttxkdabbkpw_hw8m_0s8s5yua873jyf6o4...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hello,
I have a small piece of code that does not compile and I'm having trouble
figuring out why.
Here is the relevant snippet:
readChunks :: Handle -> [String] -> IO [String]
readChunks handle accum = do
chunk <- readHeaderChunk handle
if isLast chunk
then return (accum ++ chunk)
else return (readChunks handle (accum ++ chunk))
isLast :: [String] -> Bool
readHeaderChunk :: Handle -> IO [String]
And here is the single compiler error:
hacks.hs:48:18:
Couldn't match expected type `[String]'
with actual type `IO [String]'
In the return type of a call of `readChunks'
In the first argument of `return', namely
`(readChunks handle (accum ++ chunk))'
In the expression: return (readChunks handle (accum ++ chunk))
What I'm most confused about is that chunk is passed to isLast as a
[String] with no compiler error but cannot be passed to accum ++ chunk that
way. Or so it seems. Can someone she some light on this? Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150525/19f59dd4/attachment-0001.html>
------------------------------
Message: 4
Date: Thu, 28 May 2015 16:13:25 -0500
From: Mike Meyer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Can't figure out my error here
Message-ID:
<CAD=7U2De+4CpS0Ma5P+i8mgYXvEe2-RjViZ=h1bgkwgxfen...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
readChunks is already in the IO context, so return (which, confusingly, is
not a keyword to return a value from a function, but a function that puts a
value back in a context) in the last line of readChunks needs to be deleted.
On Mon, May 25, 2015 at 12:42 PM, Barry DeZonia <[email protected]> wrote:
> Hello,
>
> I have a small piece of code that does not compile and I'm having trouble
> figuring out why.
>
> Here is the relevant snippet:
>
> readChunks :: Handle -> [String] -> IO [String]
> readChunks handle accum = do
> chunk <- readHeaderChunk handle
> if isLast chunk
> then return (accum ++ chunk)
> else return (readChunks handle (accum ++ chunk))
>
> isLast :: [String] -> Bool
>
> readHeaderChunk :: Handle -> IO [String]
>
> And here is the single compiler error:
>
> hacks.hs:48:18:
> Couldn't match expected type `[String]'
> with actual type `IO [String]'
> In the return type of a call of `readChunks'
> In the first argument of `return', namely
> `(readChunks handle (accum ++ chunk))'
> In the expression: return (readChunks handle (accum ++ chunk))
>
> What I'm most confused about is that chunk is passed to isLast as a
> [String] with no compiler error but cannot be passed to accum ++ chunk that
> way. Or so it seems. Can someone she some light on this? Thanks.
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150528/f30259ea/attachment-0001.html>
------------------------------
Message: 5
Date: Fri, 29 May 2015 02:44:27 +0530
From: "Sumit Sahrawat, Maths & Computing, IIT (BHU)"
<[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Can't figure out my error here
Message-ID:
<cajbew8ofwomodf4ualmwojdhg80r9rqgrz_ma-ovpdwnjba...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On 25 May 2015 at 23:12, Barry DeZonia <[email protected]> wrote:
> Hello,
>
> I have a small piece of code that does not compile and I'm having trouble
> figuring out why.
>
> Here is the relevant snippet:
>
> readChunks :: Handle -> [String] -> IO [String]
> readChunks handle accum = do
> chunk <- readHeaderChunk handle
> if isLast chunk
> then return (accum ++ chunk)
> else return (readChunks handle (accum ++ chunk))
>
In short, try: else readChunks handle (accum ++ chunk)
Explanation,
return :: a -> IO a (in this case)
readChunks handle (accum ++ chunk) :: IO [String]
therefore, return (readChunks handle (accum ++ chunk)) :: IO (IO [String])
> isLast :: [String] -> Bool
>
> readHeaderChunk :: Handle -> IO [String]
>
> And here is the single compiler error:
>
> hacks.hs:48:18:
> Couldn't match expected type `[String]'
> with actual type `IO [String]'
>
Wanted [String], got IO [String]
In the return type of a call of `readChunks'
> In the first argument of `return', namely
> `(readChunks handle (accum ++ chunk))'
> In the expression: return (readChunks handle (accum ++ chunk))
>
> What I'm most confused about is that chunk is passed to isLast as a
> [String] with no compiler error but cannot be passed to accum ++ chunk that
> way. Or so it seems. Can someone she some light on this? Thanks.
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
--
Regards
Sumit Sahrawat
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150529/8fe71ddc/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 83, Issue 57
*****************************************