Re: [Haskell-cafe] [ANNOUNCE] hashable-generics

2012-11-07 Thread dag.odenh...@gmail.com
A note: if you use generic-deriving instead of ghc-prim, the generics code
could in theory be portable as well. That package re-exports from ghc-prim
when compiled with GHC, and provides a compatible fallback implementation.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Cross platform method for getting the /actual/ contents of a directory

2012-11-07 Thread timothyhobbs
Hello,
I'm writing a function to find out if a given directory is empty.  I came up
with the obvious:

do{
 contents -  getDirectoryContents /home/timothy/works/current/anonGraph/
empty/ ;
 let
  realContents
    =
  filter
   (\file -
 case file of
   . - False ;
   .. - False ;
   _ - True)
   contents
 in
 return $
  case realContents of
   [] - True ;
   _ - False}

And this works fine on linux, but I wonder.  On other systems, is . and .
. allowed as file names?  Couldn't a windows user actually end up with a 
file name named . and this method would fail?

Thank you
Timothy
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Where is the documentation on exception types kept?

2012-11-07 Thread Albert Y. C. Lai

On 12-11-07 03:36 PM, timothyho...@seznam.cz wrote:

I am trying to catch an thread blocked on MVar indefinitely
exception.  Of course I can use ::SomeException as explained in
http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Exception.html#g:3
but there is no explanation as to how to find the more case specific
exceptions.


In general, because Exception instances are Typeable instances, you can 
get a name, and then you can use that for searches.


import Control.Exception
import Data.Typeable

main = do
  aida - try (readFile no)
  case aida of
Left (SomeException e) - print (typeOf e)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Where is the documentation on exception types kept?

2012-11-07 Thread timothyhobbs
Thanks!  That is a neat way.  At least for exceptions which I know to exists
and know how to trigger ;)

Tim


-- Původní zpráva --
Od: Albert Y. C. Lai tre...@vex.net
Datum: 7. 11. 2012
Předmět: Re: [Haskell-cafe] Where is the documentation on exception types 
kept?
On 12-11-07 03:36 PM, timothyho...@seznam.cz wrote:
 I am trying to catch an thread blocked on MVar indefinitely
 exception. Of course I can use ::SomeException as explained in
 http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-
Exception.html#g:3
(http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Exception.html#g:3)
 but there is no explanation as to how to find the more case specific
 exceptions.

In general, because Exception instances are Typeable instances, you can 
get a name, and then you can use that for searches.

import Control.Exception
import Data.Typeable

main = do
aida - try (readFile no)
case aida of
Left (SomeException e) - print (typeOf e)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
(http://www.haskell.org/mailman/listinfo/haskell-cafe)___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Compiling with hsc2hs and -Wextra

2012-11-07 Thread Niklas Hambüchen
Hi,

when I compile my C binding using hsc2hs with the -Wextra enabled in my
cabal file:

cc-options: -std=c99 -Wall -Wextra -Werror

This breaks the compilation started by hsc2hs:

MyHsc.hsc: In function ‘main’:
MyHsc.hsc:16:15: error: unused parameter ‘argc’
[-Werror=unused-parameter]
MyHsc.hsc:16:27: error: unused parameter ‘argv’
[-Werror=unused-parameter]
cc1: all warnings being treated as errors
compiling dist/build/MyHsc_hsc_make.c failed (exit code 1)

I would really like to compile my code with -Wextra -Werror though.

Can't we just (void) argc; (void) argv; the arguments in the generated
code, like described in [1]?

Thanks
Niklas


[1]
http://stackoverflow.com/questions/3599160/unused-parameter-warnings-in-c-code

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Haskell Weekly News: Issue 250

2012-11-07 Thread Daniel Santa Cruz
Welcome to issue 250 of the HWN, an issue covering crowd-sourced bits
of information about Haskell from around the web. This issue covers the
week of October 28 to November 3, 2012.

Quotes of the Week

   * Cale: A list is a bit like a loop which hasn't happened yet. This
 operation is similar to how do I make the 5th iteration of my loop
 do something different from the others?

   * broombs: Why are there multiple packages for EitherT?
 broombs: edwardk: which is the better one?
 edwardk: broombs: either

 And today, we have our first quote submited via twitter! Thank you
 @gersei for sending this one in. If you'd like to submit quotes via
 twitter, add @HWNQuotes to your tweet.

   * @kmett:We now generate pretty core but have ugly code.

Top Reddit Stories

   * Cartesian Closed Comic #15: Iteratees
 Domain: ro-che.info, Score: 75, Comments: 2
 On Reddit: [1] http://goo.gl/9NpD2
 Original: [2] http://goo.gl/SB7HZ

   * Are there any, or is there interest in starting, an online Haskell
course like the Scala course on Coursera?
 Domain: class.coursera.org, Score: 69, Comments: 16
 On Reddit: [3] http://goo.gl/UzBdF
 Original: [4] http://goo.gl/1Zzct

   * Why is this simple text processing program so much slower than in
dynamic languages?
 Domain: honza.ca, Score: 65, Comments: 189
 On Reddit: [5] http://goo.gl/jW5ow
 Original: [6] http://goo.gl/pPzIb

   * Fast Code Nation: The Bright Side of High-Level Languages
 Domain: bos.github.com, Score: 59, Comments: 11
 On Reddit: [7] http://goo.gl/KmBRt
 Original: [8] http://goo.gl/jm9s7

   * Fay slides
 Domain: fay-lang.org, Score: 56, Comments: 42
 On Reddit: [9] http://goo.gl/0UM4T
 Original: [10] http://goo.gl/h8iZE

   * Data.Records: extensible records using the latest GHC features
 Domain: github.com, Score: 55, Comments: 44
 On Reddit: [11] http://goo.gl/64wUj
 Original: [12] http://goo.gl/XVdB2

   * Why Cabal Has Problems
 Domain: softwaresimply.blogspot.com, Score: 50, Comments: 41
 On Reddit: [13] http://goo.gl/ZX1Ia
 Original: [14] http://goo.gl/TgnOG

   * The cabal/hackage situation, and what you can do about it
 Domain: alpmestan.com, Score: 49, Comments: 14
 On Reddit: [15] http://goo.gl/jEGIj
 Original: [16] http://goo.gl/EK2DB

   * Brian O'Sullivan's favorite bug in GHC
 Domain: twitter.com, Score: 48, Comments: 12
 On Reddit: [17] http://goo.gl/nMjeK
 Original: [18] http://goo.gl/odPH4

   * Haskell for all: Hello, core!
 Domain: haskellforall.com, Score: 45, Comments: 6
 On Reddit: [19] http://goo.gl/qXRd2
 Original: [20] http://goo.gl/9cBeo

   * Michael Snoyman: Yesod, AngularJS and Fay
 Domain: yesodweb.com, Score: 43, Comments: 26
 On Reddit: [21] http://goo.gl/8yfVd
 Original: [22] http://goo.gl/0xtPP

   * Cellular automata as comonads
 Domain: blog.sigfpe.com, Score: 41, Comments: 10
 On Reddit: [23] http://goo.gl/73nr2
 Original: [24] http://goo.gl/vH4TK

   * pipes-2.5: Faster and slimmer
 Domain: haskellforall.com, Score: 41, Comments: 56
 On Reddit: [25] http://goo.gl/wtUZg
 Original: [26] http://goo.gl/rKR2D

Top StackOverflow Questions

   * Writing cojoin or cobind for n-dimensional grid type
 votes: 41, answers: 3
 Read on SO: [27] http://goo.gl/qbz7z

   * Why not be dependently typed?
 votes: 39, answers: 3
 Read on SO: [28] http://goo.gl/1TSVh

   * Concrete example showing that monads are not closed under composition
(with proof)?
 votes: 32, answers: 4
 Read on SO: [29] http://goo.gl/sys7F

   * Monad Transformers vs Passing parameters to functions
 votes: 24, answers: 1
 Read on SO: [30] http://goo.gl/UpU57

   * Why is there no IO transformer in Haskell?
 votes: 16, answers: 2
 Read on SO: [31] http://goo.gl/04Xc7

   * Is it possible to make GHC optimize (deforest) generic functions such
as catamorphisms?
 votes: 16, answers: 1
 Read on SO: [32] http://goo.gl/f4ZlU

   * Is it possible to use irrefutable tilde (`~`) patterns in lambda
expressions?
 votes: 14, answers: 1
 Read on SO: [33] http://goo.gl/BmGY0

   * Can Scala's Cake Pattern be implemented in Haskell?
 votes: 13, answers: 2
 Read on SO: [34] http://goo.gl/QiMfg

   * Confused by the meaning of the 'Alternative' type class and its
relationship to other type classes
 votes: 13, answers: 5
 Read on SO: [35] http://goo.gl/RXNuV

   * How to add fields that only cache something to ADT?
 votes: 13, answers: 0
 Read on SO: [36] http://goo.gl/FjLlX

   * Type algebra and Knuth's up arrow notation
 votes: 13, answers: 1
 Read on SO: [37] http://goo.gl/kyYIn

Until next time,
Daniel Santa Cruz

References

   1. http://ro-che.info/ccc/15.html
   2.
http://www.reddit.com/r/haskell/comments/11t7ru/cartesian_closed_comic_15_iteratees/
   3. https://class.coursera.org/course/progfun
   4.

[Haskell-cafe] Does anyone know where George Pollard is?

2012-11-07 Thread Myles C. Maxfield
Hello,
I sent a message to George Pollard (por...@porg.es) about his 'idna'
package [1] a couple days ago, but he hasn't responded. I'd like to
depend on his package for something that I'm working on, but his
package fails to build (The email I sent him includes a patch that
should fix up the build problems). The package hasn't been updated for
3 years and he hasn't listed a source control repository.

Does anyone know where he is? If not, is there an accepted practice to
resolve this situation? Should I upload my own 'idna2' package?

Thanks,
Myles

[1] http://hackage.haskell.org/package/idna

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Does anyone know where George Pollard is?

2012-11-07 Thread Johan Tibell
On Wed, Nov 7, 2012 at 9:03 PM, Myles C. Maxfield
myles.maxfi...@gmail.comwrote:

 Does anyone know where he is? If not, is there an accepted practice to
 resolve this situation? Should I upload my own 'idna2' package.


Generally we try to contact the maintainer (and give him/her enough time to
reply, in case he/she is e.g. on vacation). After that someone can announce
their intention to take over maintenance of the package.

-- Johan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe