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: type vs data, again... (Emmanuel Touzery)
2. Re: type vs data, again... (David McBride)
3. Re: type vs data, again... (Emmanuel Touzery)
4. Re: Confused about lazy IO (Kim-Ee Yeoh)
----------------------------------------------------------------------
Message: 1
Date: Sun, 17 Mar 2013 16:16:41 +0100
From: Emmanuel Touzery <[email protected]>
Subject: Re: [Haskell-beginners] type vs data, again...
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<CAC42Rem_O2LkYrvU=2=ttwp1pjia6unzd17vljr5w9h8gop...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Thank you, that was the trick! It would be handy it there was a way through
the online hackage packages pages to click through the dependencies. I
guess you checked the .cabal by hand or used some slightly more arcane
cabal commands to get that information.
Thank you again and nice rest of week-end!
Emmanuel
On Sun, Mar 17, 2013 at 2:51 PM, Andres L?h <[email protected]> wrote:
> Hi again.
>
> > thank you for the tip! It helps but it's not quite there yet. If you see
> > the program in attachment, I can make it compile only by commenting the
> type
> > declaration for the second function, otherwise it's the exact same error
> > message as before.
>
> You're probably using the wrong HashMap. There are several packages on
> Hackage implementing similarly-named data structures (which is
> confusing, I know, but such is life in a decentralized and open
> world). You should use what aeson is using (because that's the library
> defining the Object type synonym).
>
> Looking at the import list of
>
>
> http://hackage.haskell.org/packages/archive/aeson/0.6.0.2/doc/html/src/Data-Aeson-Types-Internal.html
>
> we see
>
> import Data.HashMap.Strict (HashMap)
>
> and by checking the package dependencies of aeson, we figure out that
> this module is provided by the unordered-containers package.
>
> Cheers,
> Andres
>
> --
> Andres L?h, Haskell Consultant
> Well-Typed LLP, http://www.well-typed.com
>
> _______________________________________________
> 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/20130317/87a51a9c/attachment-0001.htm>
------------------------------
Message: 2
Date: Sun, 17 Mar 2013 11:25:29 -0400
From: David McBride <[email protected]>
Subject: Re: [Haskell-beginners] type vs data, again...
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<can+tr43b4gjwxof0lu1cn5yq_3eamxjnq29vtr0docd6qcu...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
If you hover over "type Object = HashMap Text Value" in
Data.Aeson.Types in hackage, you will see that the HashMap link links
to
http://hackage.haskell.org/packages/archive/unordered-containers/0.2.3.0/doc/html/Data-HashMap-Strict.html#t:HashMap,
which tells you what package it came from and what to import.
On Sun, Mar 17, 2013 at 11:16 AM, Emmanuel Touzery <[email protected]> wrote:
> Thank you, that was the trick! It would be handy it there was a way through
> the online hackage packages pages to click through the dependencies. I guess
> you checked the .cabal by hand or used some slightly more arcane cabal
> commands to get that information.
>
> Thank you again and nice rest of week-end!
>
> Emmanuel
>
>
> On Sun, Mar 17, 2013 at 2:51 PM, Andres L?h <[email protected]> wrote:
>>
>> Hi again.
>>
>> > thank you for the tip! It helps but it's not quite there yet. If you
>> > see
>> > the program in attachment, I can make it compile only by commenting the
>> > type
>> > declaration for the second function, otherwise it's the exact same error
>> > message as before.
>>
>> You're probably using the wrong HashMap. There are several packages on
>> Hackage implementing similarly-named data structures (which is
>> confusing, I know, but such is life in a decentralized and open
>> world). You should use what aeson is using (because that's the library
>> defining the Object type synonym).
>>
>> Looking at the import list of
>>
>>
>> http://hackage.haskell.org/packages/archive/aeson/0.6.0.2/doc/html/src/Data-Aeson-Types-Internal.html
>>
>> we see
>>
>> import Data.HashMap.Strict (HashMap)
>>
>> and by checking the package dependencies of aeson, we figure out that
>> this module is provided by the unordered-containers package.
>>
>> Cheers,
>> Andres
>>
>> --
>> Andres L?h, Haskell Consultant
>> Well-Typed LLP, http://www.well-typed.com
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
------------------------------
Message: 3
Date: Sun, 17 Mar 2013 17:08:40 +0100
From: Emmanuel Touzery <[email protected]>
Subject: Re: [Haskell-beginners] type vs data, again...
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<cac42remqxpfckhd_7fdkmyq_z+u8d7bwwhqhjshfkogdovt...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Yes, you are right thank you. I don't know how could I miss it...
emmanuel
On Sun, Mar 17, 2013 at 4:25 PM, David McBride <[email protected]> wrote:
> If you hover over "type Object = HashMap Text Value" in
> Data.Aeson.Types in hackage, you will see that the HashMap link links
> to
> http://hackage.haskell.org/packages/archive/unordered-containers/0.2.3.0/doc/html/Data-HashMap-Strict.html#t:HashMap
> ,
> which tells you what package it came from and what to import.
>
> On Sun, Mar 17, 2013 at 11:16 AM, Emmanuel Touzery <[email protected]>
> wrote:
> > Thank you, that was the trick! It would be handy it there was a way
> through
> > the online hackage packages pages to click through the dependencies. I
> guess
> > you checked the .cabal by hand or used some slightly more arcane cabal
> > commands to get that information.
> >
> > Thank you again and nice rest of week-end!
> >
> > Emmanuel
> >
> >
> > On Sun, Mar 17, 2013 at 2:51 PM, Andres L?h <[email protected]>
> wrote:
> >>
> >> Hi again.
> >>
> >> > thank you for the tip! It helps but it's not quite there yet. If you
> >> > see
> >> > the program in attachment, I can make it compile only by commenting
> the
> >> > type
> >> > declaration for the second function, otherwise it's the exact same
> error
> >> > message as before.
> >>
> >> You're probably using the wrong HashMap. There are several packages on
> >> Hackage implementing similarly-named data structures (which is
> >> confusing, I know, but such is life in a decentralized and open
> >> world). You should use what aeson is using (because that's the library
> >> defining the Object type synonym).
> >>
> >> Looking at the import list of
> >>
> >>
> >>
> http://hackage.haskell.org/packages/archive/aeson/0.6.0.2/doc/html/src/Data-Aeson-Types-Internal.html
> >>
> >> we see
> >>
> >> import Data.HashMap.Strict (HashMap)
> >>
> >> and by checking the package dependencies of aeson, we figure out that
> >> this module is provided by the unordered-containers package.
> >>
> >> Cheers,
> >> Andres
> >>
> >> --
> >> Andres L?h, Haskell Consultant
> >> Well-Typed LLP, http://www.well-typed.com
> >>
> >> _______________________________________________
> >> Beginners mailing list
> >> [email protected]
> >> http://www.haskell.org/mailman/listinfo/beginners
> >
> >
> >
> > _______________________________________________
> > 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/20130317/205b0ec4/attachment-0001.htm>
------------------------------
Message: 4
Date: Mon, 18 Mar 2013 01:44:05 +0700
From: Kim-Ee Yeoh <[email protected]>
Subject: Re: [Haskell-beginners] Confused about lazy IO
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<CAPY+ZdT6kzXGaD2uy4YcBEM7bETcu-nKwpnN+kP=t02bjt0...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
On Fri, Mar 15, 2013 at 5:52 AM, Jacek Dudek <[email protected]> wrote:
> (1) What is the proper way to reason about lazy IO?
Lazy IO is pull-driven. The stuff that comes out of a lazy read needs
to be /pulled/ by some weight to be actually read. The function
putStrLn exerts weight, as you've discovered. So does writeFile.
What's weightless is a pure function "lifted" (by liftM aka fmap) into IO.
> (2) Is there some action less arbitrary that what I cooked up in the
> second version that explicitly instructs to release a file or some
> other resource?
Explicitly managing resources means going the whole nine yards of
imperative programming. Which means reading and writing in
program-specified chunks, opening and closing file handles, dealing
with IO errors, etc.
If this sounds a lot like manual memory management, that's because it is.
So the dream is: is there an analogue of GC doing for IO what GC now
does for RAM?
Lazy I/O can be thought of as an hors d'oeuvre of that dream. Some
have complained about a queasy feeling in the stomach afterward.
Some of the strongest detractors of lazy I/O have proposed iteratees
as a more realistic substitute.
Just a few hours ago, Dan Doel wrote an email [1] to the haskell-cafe
list explaining how some problems of Lazy I/O can be resolved by even
more laziness, not less. I read his email as keeping the dream alive.
(Others may differ.)
GC gives the illusion of infinite RAM.
What would the illusion of infinite IO be like?
So to recap: if you run into issues with Lazy I/O, the fixes include:
* Replace lazy with strict I/O. Make sure you have enough RAM,
especially if you still use String, as opposed to ByteString.
* Use strict I/O but leave off readFile. Chunk explicitly. Code imperatively.
* Use iteratees
* Use unsafeInterleaveIO. Watch the envelope bend.
[1] http://www.haskell.org/pipermail/haskell-cafe/2013-March/107027.html
-- Kim-Ee
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 57, Issue 25
*****************************************