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: what is "Gesh"? (Re: function not working as expected,
type issues) (Brandon Allbery)
2. Re: what is "Gesh"? (Re: function not working as expected,
type issues) (Gesh)
3. Re: parsing exif file: binary, binary-strict, or cereal?
(Yitzchak Gale)
4. Re: parsing exif file: binary, binary-strict, or cereal?
(Emmanuel Touzery)
5. Re: parsing exif file: binary, binary-strict, or cereal?
(Emmanuel Touzery)
6. How do I use Guards in record syntax? (Dimitri DeFigueiredo)
----------------------------------------------------------------------
Message: 1
Date: Sun, 13 Apr 2014 09:40:04 -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] what is "Gesh"? (Re: function not
working as expected, type issues)
Message-ID:
<CAKFCL4Umihv0F0Gq9kKYZBAjVMs22EoNHmRwuaHdZqfwaD=t...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Sun, Apr 13, 2014 at 12:02 AM, John M. Dlugosz
<[email protected]>wrote:
> On 4/9/2014 3:45 AM, Gesh wrote:
>
>> Thank you for explaining the problem you're trying to solve instead of
>> Gesh
>> problem you're facing.
>>
>
> Is that some jargon I'm missing? Hmm, I see that's your name and email
> address too.
>
I think it's just different mailers misinterpreting and badly wrapping
different quoting styles.
--
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://www.haskell.org/pipermail/beginners/attachments/20140413/eed92f83/attachment-0001.html>
------------------------------
Message: 2
Date: Sun, 13 Apr 2014 16:55:37 +0300
From: Gesh <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] what is "Gesh"? (Re: function not
working as expected, type issues)
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8
On April 13, 2014 7:02:19 AM GMT+03:00, "John M. Dlugosz"
<[email protected]> wrote:
>On 4/9/2014 3:45 AM, Gesh wrote:
>> Thank you for explaining the problem you're trying to solve instead
>of Gesh
>> problem you're facing.
>
>Is that some jargon I'm missing? Hmm, I see that's your name and email
>address too.
>
>
>_______________________________________________
>Beginners mailing list
>[email protected]
>http://www.haskell.org/mailman/listinfo/beginners
Sorry, my autocorrect must have put that in instead of "the". And it's the
nickname I use, not jargon.
Sorry.
------------------------------
Message: 3
Date: Sun, 13 Apr 2014 17:30:48 +0300
From: Yitzchak Gale <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] parsing exif file: binary,
binary-strict, or cereal?
Message-ID:
<CAOrUaLZYH43Kt07x2f386YWNFTpz-Ng-AOAUNVm4+npXmJ=q...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Emmanuel Touzery wrote:
> I could not find a pure haskell library to parse EXIF so I wrote one
> (pretty basic so far):
> https://github.com/emmanueltouzery/hsexif
Very nice! Why not upload it to hackage to make it easier
for others to share and collaborate?
> I wrote it with binary-strict. I also considered binary, but I would like
> the library not to throw an exception if the file that it's given is not a
> JPEG or is a JPEG without EXIF, but rather return an Either. I didn't manage
> to do that with binary
Perhaps the function Data.Binary.Get.runGetOrFail is what
you are looking for? Or perhaps the incremental strict interface?
> And then I realized that binary-strict was last updated in 2010, it seems
> cereal is recommended for strict binary file parsing nowadays.
> So, what should I do? Leave it as it is? Port to cereal? Port to binary?
The binary-strict library is no longer maintained, since binary now also
provides a strict interface. Both binary and cereal are good choices.
Probably porting to binary would be easiest if you've already written
it for binary-strict, assuming runGetOrFail or the incremental interface
does what you want.
Regards,
Yitz
------------------------------
Message: 4
Date: Sun, 13 Apr 2014 17:08:27 +0200
From: Emmanuel Touzery <[email protected]>
To: [email protected], The Haskell-Beginners Mailing List - Discussion
of primarily beginner-level topics related to Haskell
<[email protected]>
Subject: Re: [Haskell-beginners] parsing exif file: binary,
binary-strict, or cereal?
Message-ID:
<cac42rek6w-blrmgkfa-fmwnpncaw4nza6zogu2nsa4mckm5...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
On Sun, Apr 13, 2014 at 4:30 PM, Yitzchak Gale <[email protected]> wrote:
> Emmanuel Touzery wrote:
> > I could not find a pure haskell library to parse EXIF so I wrote one
> > (pretty basic so far):
> > https://github.com/emmanueltouzery/hsexif
>
> Very nice! Why not upload it to hackage to make it easier
> for others to share and collaborate?
>
Yes, that's the plan as soon as I get the basics right and that I write
some short documentation. Hopefully very quickly.
>
> > I wrote it with binary-strict. I also considered binary, but I would like
> > the library not to throw an exception if the file that it's given is not
> a
> > JPEG or is a JPEG without EXIF, but rather return an Either. I didn't
> manage
> > to do that with binary
>
> Perhaps the function Data.Binary.Get.runGetOrFail is what
> you are looking for? Or perhaps the incremental strict interface?
>
Ah yes... Actually I was a bit mislead because I found an haskell wiki
stating that with binary it was impossible to catch the exceptions except
in the IO monad and I took that at face value. I think runGetOrFail is what
I want, I'll test it, thank you!
>
> > And then I realized that binary-strict was last updated in 2010, it
> seems
> > cereal is recommended for strict binary file parsing nowadays.
> > So, what should I do? Leave it as it is? Port to cereal? Port to binary?
>
> The binary-strict library is no longer maintained, since binary now also
> provides a strict interface. Both binary and cereal are good choices.
>
> Probably porting to binary would be easiest if you've already written
> it for binary-strict, assuming runGetOrFail or the incremental interface
> does what you want.
>
Ok, then I'll try the non-strict binary first then. Most JPG files will be
only a couple of megabytes and it wouldn't be THAT bad loading them
entirely in memory but then, it seems a bit of a shame. With lazy though
I'll have to work a bit on my strictness annotations I think.
Thanks for the hints! Hopefully I can port it to lazy binary and publish it
on hackage soon enough...
Emmanuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140413/afe7c930/attachment-0001.html>
------------------------------
Message: 5
Date: Sun, 13 Apr 2014 17:18:29 +0200
From: Emmanuel Touzery <[email protected]>
To: [email protected], The Haskell-Beginners Mailing List - Discussion
of primarily beginner-level topics related to Haskell
<[email protected]>
Subject: Re: [Haskell-beginners] parsing exif file: binary,
binary-strict, or cereal?
Message-ID:
<CAC42Rem41OxR2UL=QqEXeK=esxsm48xs+v5vhojzscaqf7r...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
well, it went fast :-)
already ported.
regarding strictness, i hope just doing that is enough:
data IfEntry = IfEntry
{
entryTag :: !Word16,
entryFormat :: !Word16,
entryNoComponents :: !Word32,
entryContents :: !Word32
} deriving Show
Though from past experience, I'm far from sure.
I'll add comments soon and then push it to hackage.
emmanuel
On Sun, Apr 13, 2014 at 5:08 PM, Emmanuel Touzery <[email protected]>wrote:
>
>
>
> On Sun, Apr 13, 2014 at 4:30 PM, Yitzchak Gale <[email protected]> wrote:
>
>> Emmanuel Touzery wrote:
>> > I could not find a pure haskell library to parse EXIF so I wrote one
>> > (pretty basic so far):
>> > https://github.com/emmanueltouzery/hsexif
>>
>> Very nice! Why not upload it to hackage to make it easier
>> for others to share and collaborate?
>>
>
>
> Yes, that's the plan as soon as I get the basics right and that I write
> some short documentation. Hopefully very quickly.
>
>
>>
>> > I wrote it with binary-strict. I also considered binary, but I would
>> like
>> > the library not to throw an exception if the file that it's given is
>> not a
>> > JPEG or is a JPEG without EXIF, but rather return an Either. I didn't
>> manage
>> > to do that with binary
>>
>> Perhaps the function Data.Binary.Get.runGetOrFail is what
>> you are looking for? Or perhaps the incremental strict interface?
>>
>
> Ah yes... Actually I was a bit mislead because I found an haskell wiki
> stating that with binary it was impossible to catch the exceptions except
> in the IO monad and I took that at face value. I think runGetOrFail is what
> I want, I'll test it, thank you!
>
>
>>
>> > And then I realized that binary-strict was last updated in 2010, it
>> seems
>> > cereal is recommended for strict binary file parsing nowadays.
>> > So, what should I do? Leave it as it is? Port to cereal? Port to
>> binary?
>>
>> The binary-strict library is no longer maintained, since binary now also
>> provides a strict interface. Both binary and cereal are good choices.
>>
>> Probably porting to binary would be easiest if you've already written
>> it for binary-strict, assuming runGetOrFail or the incremental interface
>> does what you want.
>>
>
> Ok, then I'll try the non-strict binary first then. Most JPG files will be
> only a couple of megabytes and it wouldn't be THAT bad loading them
> entirely in memory but then, it seems a bit of a shame. With lazy though
> I'll have to work a bit on my strictness annotations I think.
>
> Thanks for the hints! Hopefully I can port it to lazy binary and publish
> it on hackage soon enough...
>
> Emmanuel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140413/1f7f66ea/attachment-0001.html>
------------------------------
Message: 6
Date: Mon, 14 Apr 2014 00:03:20 -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] How do I use Guards in record syntax?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
I'm having some trouble understanding where I can or cannot use guards
inside record syntax. I'm writing a simple conversion routine, but I am
not able to write it without inserting an extra let. Do I need a let
expression here? Am I missing something?
--------------
data OldTrade = OldTrade {
oldprice :: Double ,
oldamount :: Double ,
oldbuysell :: String -- "buy", "sell" or ""
} deriving( Eq, Show)
data BuyOrSell = Buy | Sell | Unknown deriving(Eq, Show)
data Trade = Trade {
price :: Double ,
amount :: Double ,
buysell :: BuyOrSell
} deriving( Eq, Show)
convert :: OldTrade -> Trade
convert ot = Trade { price = oldprice ot,
amount = oldamount ot,
buysell = let x | oldbuysell ot == "buy" = Buy
| oldbuysell ot == "sell" = Sell
| otherwise = Unknown
in x
}
-- how do I eliminate the 'let' expression here?
-- I wanted to write something like:
--
-- buysell | oldbuysell ot == "buy" = Buy
-- | oldbuysell ot == "sell" = Sell
-- | otherwise = Unknown
--------------
Thanks!
Dimitri
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 70, Issue 27
*****************************************