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: code review (Henk-Jan van Tuyl)
2. wx lists on holidays? DnD Question.. (luc taesch)
3. Re: wx lists on holidays? DnD Question.. (Kim-Ee Yeoh)
4. Re: wx lists on holidays? DnD Question.. (luc taesch)
5. Re: wx lists on holidays? DnD Question.. (Kim-Ee Yeoh)
6. doesFileExist cannot get ~/blah_blah right (Hong Yang)
7. Re: doesFileExist cannot get ~/blah_blah right (Erlend Hamberg)
8. Re: doesFileExist cannot get ~/blah_blah right (Kim-Ee Yeoh)
9. Problems with parsing in attoparsec (Michel Kuhlmann)
----------------------------------------------------------------------
Message: 1
Date: Mon, 08 Apr 2013 15:17:37 +0200
From: "Henk-Jan van Tuyl" <[email protected]>
Subject: Re: [Haskell-beginners] code review
To: [email protected], "Chris Bolton" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
delsp=yes
On Fri, 05 Apr 2013 07:49:01 +0200, Chris Bolton <[email protected]> wrote:
> Just a little code review if anyone has the time :)
>
> http://codereview.stackexchange.com/questions/24741/simple-in-memory-db
It is considered good practice to write the type of all top level
functions, for documentation purposes and for better compiler error
messages.
Change:
cmdKey c = let Just s = key c in s
cmdValue c = let Just s = value c in s
to:
cmdKey c = fromJust $ key c
cmdValue c = fromJust $ value c
or:
cmdKey = fromJust . key
cmdValue = fromJust . value
Note, that your program will crash if you try to evaluate
cmdValue Nothing
; there a function fromMaybe that allows you to specify a default value
for this case.
You can simplify:
end = case name of
"end" -> True
_ -> False
to:
end = name == "end"
Regards,
Henk-Jan van Tuyl
--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--
------------------------------
Message: 2
Date: Mon, 8 Apr 2013 15:35:30 +0200
From: luc taesch < [email protected]>
Subject: [Haskell-beginners] wx lists on holidays? DnD Question..
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-1; format=flowed
It looks like I cannot push any messges to the wx lists for 28/4.
is there only moderator , that would be out in holidays ?
Your mail to 'wxhaskell-users' with the subject ...
Is being held until the list moderator can review it for approval.
Is ther only one moderator possible ? (Otherwise, I may volonteer, as I
may need it for the next month ;-)-
are there any other channel in the meantime ? any IRC ?
I had a Drag and Drop question I documented here :
http://stackoverflow.com/questions/15867654/wx-haskell-drag-and-drop-example
if anyone could help..
------------------------------
Message: 3
Date: Tue, 9 Apr 2013 00:40:35 +0700
From: Kim-Ee Yeoh <[email protected]>
Subject: Re: [Haskell-beginners] wx lists on holidays? DnD Question..
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<CAPY+ZdQ=n5gko3nk_poa8kv0a7g1t_67lcpirfx70ca3_pu...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
On Mon, Apr 8, 2013 at 8:35 PM, luc taesch <[email protected]> wrote:
> It looks like I cannot push any messges to the wx lists for 28/4.
> is there only moderator , that would be out in holidays ?
This request reads as a bit pushy. Would you like to spell out what's
the urgency?
Do note that the wxhaskell team are hobbyist volunteers. Guess what
happens when people don't hold up their end of the community?
-- Kim-Ee
------------------------------
Message: 4
Date: Mon, 8 Apr 2013 22:49:31 +0200
From: luc taesch < [email protected]>
Subject: Re: [Haskell-beginners] wx lists on holidays? DnD Question..
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-1; format=flowed
On 2013-04-08 17:40:35 +0000, Kim-Ee Yeoh said:
> On Mon, Apr 8, 2013 at 8:35 PM, luc taesch <[email protected]> wrote:
>> It looks like I cannot push any messges to the wx lists for 28/4.
>> is there only moderator , that would be out in holidays ?
>
> This request reads as a bit pushy.
Did not meant to be, Kiim. I was rather trying to detect any
technical issues on SF lists, or whatever, as my previous posts has no
such delay.
The other options I considered was holidays, ( which is quite an option
these days, indeed ;-)
and so, I was proposing myself for the job of spam filtering, if that
is possble to have more than moderator.
in the meantime, I was lucky enough to see the light and find my
answers, and pushed them as a getting started on Drag And Drop. I f any
interest, I can push this to haskell wiki, or wherever you prefer.
http://stackoverflow.com/questions/15867654/wx-haskell-drag-and-drop-example
------------------------------
Message: 5
Date: Tue, 9 Apr 2013 04:30:21 +0700
From: Kim-Ee Yeoh <[email protected]>
Subject: Re: [Haskell-beginners] wx lists on holidays? DnD Question..
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<capy+zdtj0vgoosubjae9xtgsfghytu1fed3dykattrrjxnn...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
If you have communicated with the wxhaskell team before, you'd have
their email addresses and you could email them directly.
Pre-google it used to be that things like this need to be pushed to a
wiki. Maybe not any more. Consult with the team.
Wxhaskell issues may also be more pertinently queried on the cafe list.
-- Kim-Ee
On Tue, Apr 9, 2013 at 3:49 AM, luc taesch <[email protected]> wrote:
> On 2013-04-08 17:40:35 +0000, Kim-Ee Yeoh said:
>
>> On Mon, Apr 8, 2013 at 8:35 PM, luc taesch <[email protected]> wrote:
>>>
>>> It looks like I cannot push any messges to the wx lists for 28/4.
>>> is there only moderator , that would be out in holidays ?
>>
>>
>> This request reads as a bit pushy.
>
>
> Did not meant to be, Kiim. I was rather trying to detect any technical
> issues on SF lists, or whatever, as my previous posts has no such delay.
>
> The other options I considered was holidays, ( which is quite an option
> these days, indeed ;-)
> and so, I was proposing myself for the job of spam filtering, if that is
> possble to have more than moderator.
>
> in the meantime, I was lucky enough to see the light and find my answers,
> and pushed them as a getting started on Drag And Drop. I f any interest, I
> can push this to haskell wiki, or wherever you prefer.
>
> http://stackoverflow.com/questions/15867654/wx-haskell-drag-and-drop-example
>
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
------------------------------
Message: 6
Date: Mon, 8 Apr 2013 17:45:08 -0500
From: Hong Yang <[email protected]>
Subject: [Haskell-beginners] doesFileExist cannot get ~/blah_blah
right
To: [email protected]
Message-ID:
<ca+_a4u7yqoryzfapvpkfp-dc01wqvyzaoubv5z9-ruyn_nr...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi,
I got "not exists ..." from
fileExists <- doesFileExist "~/blah_blah"
if fileExists then print "exists ..."
else print "not exists ..."
using the directory-1.1.0.2 package, when ~/blah_blah does exist.
I do not want to change "~" to a specific home directory such as
"/home/a_userid" for the sake of portability. What else can I do before the
bug (suppose this is a bug) is fixed?
Thanks,
Hong
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130408/705f3edb/attachment-0001.htm>
------------------------------
Message: 7
Date: Mon, 8 Apr 2013 16:04:22 -0700
From: Erlend Hamberg <[email protected]>
Subject: Re: [Haskell-beginners] doesFileExist cannot get ~/blah_blah
right
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<ca+g9oxkyjftqfnfqrpexx67cfeasx27zlkqyfc+_8wvnlqp...@mail.gmail.com>
Content-Type: text/plain; charset="windows-1252"
On 8 April 2013 15:45, Hong Yang <[email protected]> wrote:
> I got "not exists ..." from
>
> fileExists <- doesFileExist "~/blah_blah"
> if fileExists then print "exists ..."
> else print "not exists ..."
>
> using the directory-1.1.0.2 package, when ~/blah_blah does exist.
>
When you type ?~/blah_blah? in your shell, the *shell* will expand ?~? to
your home directory, so when you pass ?~/foo? to a program, that program
never sees ?~/foo?, but ?/home/user/foo?. In other words, ?~/blah_blah?
probably does *not* exist.
What you probably should do is to find the user's home directory and
prepend that to ?blah_blah?. You can find a user's homedir by calling
`getHomeDirectory` from `System.Directory`:
Prelude System.Directory> homedir <- getHomeDirectory
Prelude System.Directory> putStrLn $ homedir ++ "/blah_blah"
/Users/ehamberg/blah_blah
--
Erlend Hamberg
[email protected]
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130408/55b30c89/attachment-0001.htm>
------------------------------
Message: 8
Date: Tue, 9 Apr 2013 06:20:57 +0700
From: Kim-Ee Yeoh <[email protected]>
Subject: Re: [Haskell-beginners] doesFileExist cannot get ~/blah_blah
right
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<CAPY+ZdRC5nORkRc-fBUdo6Dy_J=pqjh++eggvkbgjbf1pyd...@mail.gmail.com>
Content-Type: text/plain; charset=windows-1252
On Tue, Apr 9, 2013 at 6:04 AM, Erlend Hamberg <[email protected]> wrote:
> When you type ?~/blah_blah? in your shell, the *shell* will expand ?~? to
> your home directory, so when you pass ?~/foo? to a program, that program
> never sees ?~/foo?, but ?/home/user/foo?. In other words, ?~/blah_blah?
> probably does *not* exist.
To expand on this, doesFileExist is a thin shim over a low-level OS call.
On the other hand, tilde expansion happens at the shell (application) level.
-- Kim-Ee
------------------------------
Message: 9
Date: Tue, 9 Apr 2013 08:00:55 +0200
From: Michel Kuhlmann <[email protected]>
Subject: [Haskell-beginners] Problems with parsing in attoparsec
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Hi,
I couldn't figure out, why I'm failing with attoparsec.
I have the follwing code (https://github.com/michelk/devsurf/tree/readNet)
import Data.Attoparsec.Text
import qualified Data.Text as T
import Language.DevSurf.Readers.SpringNet
import Prelude hiding (takeWhile, take)
data IndexedFace
= IndexedFaceTriangle Int Int Int
| IndexedFaceQuad Int Int Int Int
deriving (Show)
-- | block of faces-lines
faces :: Parser [[(Int, IndexedFace)]]
faces = faceLine `sepBy` endOfLine
-- | Line containing up to two indexed faces
faceLine :: Parser [(Int, IndexedFace)]
faceLine = face `sepBy` (take 6)
-- | single indexed-face
face :: Parser (Int, IndexedFace)
face = do
i <- index
v1 <- index
v2 <- index
v3 <- index
v4 <- index
case v4 of
0 -> return (i, IndexedFaceTriangle v1 v2 v3)
_ -> return (i, IndexedFaceQuad v1 v2 v3 v4)
-- | node or face index 6 wide
index :: Parser Int
index = do
i <- take 6
return . read . T.unpack $ i
When testing, the follwing is working:
testEleL2 = do
let ele = T.pack " 1 10 1 9 0 2 1
2 9 0\n"
r = parse faceLine ele
case r of
Partial _ -> print $ feed r (T.pack "")
_ -> print r
testEles = do
let eles = T.pack $ concat [" 1 10 1 9 0 2
1 2 9 0\n"
--," 3 11 9 2 0\n"
," 4 12 8 1 0\n"
]
r = parse faces eles
case r of
Partial _ -> print $ feed r (T.pack "")
_ -> print r
testEles = do
let eles = T.pack $ concat [" 1 10 1 9 0 2
1 2 9 0\n"
," 3 11 9 2 0\n"
--," 4 12 8 1 0\n"
]
r = parse faces eles
case r of
Partial _ -> print $ feed r (T.pack "")
_ -> print r
But this is not working
testEles = do
let eles = T.pack $ concat [" 1 10 1 9 0 2
1 2 9 0\n"
," 3 11 9 2 0\n"
," 4 12 8 1 0\n"
]
r = parse faces eles
case r of
Partial _ -> print $ feed r (T.pack "")
_ -> print r
testEles = do
let eles = T.pack $ concat [" 1 10 1 9 0 2
1 2 9 0\n"
," 3 11 9 2 0 4
12 8 1 0\n"
]
r = parse faces eles
case r of
Partial _ -> print $ feed r (T.pack "")
_ -> print r
Please help.
Thanks, Michel
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 58, Issue 18
*****************************************