Re: [Haskell-cafe] sequence causing stack overflow on pretty small lists

2013-08-28 Thread Henning Thielemann


On Tue, 27 Aug 2013, John Lato wrote:


[1] Most people are physically incapable of reading documents that explain why 
what they want to do won't
work.  Even if people did read the documentation, I suspect that the people 
most in need of the information
would be the least likely to understand how it applies to their situation.


Plus: I don't expect that programmers read the documentation of 'sequence' 
and 'mapM' again every time they use the function.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cpphs calls error when it finds an #error declaration

2013-08-28 Thread Malcolm Wallace

On 27 Aug 2013, at 08:33, Niklas Hambüchen wrote:

 @Malcolm, would you mind a change towards throwing an exception that is
 different from error so that it can be easily caught, or even better, a
 change from
 
runCpphs :: ... - IO String
 
 to
 
runCpphs :: ... - IO (Either String String)
 
 or similar?

Have you tried simply wrapping the call to runCpphs in a catch?  Something 
like

safeRunCpphs :: ... - IO (Either String String)
safeRunCpphs foo = fmap Right (runCpphs foo) `catch` (\(UserError s)- Left 
s

 If an exception based interface is kept, it would be nice to add some
 haddock to `runCpphs`; not knowing about the existence of #error, it is
 easy to assume that the IO is only used for accessing the FilePath
 passed in.

The IO is used also for reading #include'd files, of course.  I'd be happy to 
add some extra documentation making the behaviour on #error clearer, if you can 
suggest some text that would have helped you.

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


[Haskell-cafe] Proposal: Polymorphic typeclass and Records

2013-08-28 Thread Wvv
Let we have data in one module as this:

data Person  = Person  { personId :: Int, name :: String }
data Address a = Address { personId :: Int, address :: String , way :: 
a}

It was discussed a lot in topics OverloadedRecordFields

This is an alternative:
Let we have polymorphic typeclass:

  class Record{f} a b | a - b where
  f :: a - b

so, compiler could create instances for our data as:

instance Record{personId} Person Int where
personId (Person x _) = x

instance Record{personId} (Address a) Int where
personId (Address x _ _) = x

instance Record{way} (Address Int) Int where
way (Address _ _ x) = x 

and we could use this:

p:: Record {personId} r Int = r - Int
p = personId


What do you think about this?



--
View this message in context: 
http://haskell.1045720.n5.nabble.com/Proposal-Polymorphic-typeclass-and-Records-tp5735096.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] cpphs calls error when it finds an #error declaration

2013-08-28 Thread Niklas Hambüchen
On 29/08/13 00:43, Malcolm Wallace wrote:
 Have you tried simply wrapping the call to runCpphs in a catch?  Something 
 like
 
 safeRunCpphs :: ... - IO (Either String String)
 safeRunCpphs foo = fmap Right (runCpphs foo) `catch` (\(UserError s)- 
 Left s

Yes, that is what I'm doing at the moment. The problem with this is that
it does not allow me to distinguish between a programmer error (error)
on the caller or implementation side, and an #error in the input file.

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


[Haskell-cafe] Haskell Weekly News: Issue 278

2013-08-28 Thread Daniel Santa Cruz
Welcome to issue 278 of the HWN, an issue covering crowd-sourced bits
of information about Haskell from around the web. This issue covers the
week of August 18 to 24, 2013.

Quotes of the Week

   * johnw: finger trees must be related to palm trees somehow

   * monochrom: do, or undo. there is no redo. :)

   * danharaj: arrows are just strong monads in the 2-category of
 profunctors. what's the problem?

   * BMeph: If only they knew the POWER...of the darcs-IDE!

   * geekosaur: tekmo and the pipes list sounds like some kind of
 postmodernist band

Top Reddit Stories

   * Building an Asteroids Clone in Haskell using Netwire
 Domain: ocharles.org.uk, Score: 88, Comments: 22
 On Reddit: [1] http://goo.gl/HZBtcK
 Original: [2] http://goo.gl/Gp8TVw

   * What's new in Cabal 1.18 - sandboxes, REPL, cross-compilation and more!
 Domain: coldwa.st, Score: 75, Comments: 18
 On Reddit: [3] http://goo.gl/8eSChe
 Original: [4] http://goo.gl/VrHkMY

   * An Introduction to Cabal sandboxes
 Domain: coldwa.st, Score: 64, Comments: 33
 On Reddit: [5] http://goo.gl/oFGzfK
 Original: [6] http://goo.gl/ByA6Ru

   * Reasoning about space leaks with space invariants
 Domain: apfelmus.nfshost.com, Score: 59, Comments: 48
 On Reddit: [7] http://goo.gl/cKlPrM
 Original: [8] http://goo.gl/E4kIjD

   * Bound: Making de Bruijn Succ Less on School of Haskell by Edward Kmett
 Domain: fpcomplete.com, Score: 48, Comments: 14
 On Reddit: [9] http://goo.gl/v7tgWO
 Original: [10] http://goo.gl/glTA3N

   * PatternSynonyms - ghc trac
 Domain: ghc.haskell.org, Score: 35, Comments: 14
 On Reddit: [11] http://goo.gl/8zuy1T
 Original: [12] http://goo.gl/5Bw6FN

   * Revisiting Matrix Multiplication, Part III:
 Customizing Vector by Edward Kmett
 Domain: fpcomplete.com, Score: 33, Comments: 1
 On Reddit: [13] http://goo.gl/hfoJJ7
 Original: [14] http://goo.gl/yLUSWP

   * Great new platform to increase *practical* code literacy
 (with Haskell support).
 Domain: mdswanson.com, Score: 29, Comments: 13
 On Reddit: [15] http://goo.gl/sFLBQm
 Original: [16] http://goo.gl/TIJPTi

   * Bartosz' basic Haskell: Error Handling
 Domain: fpcomplete.com, Score: 28, Comments: 4
 On Reddit: [17] http://goo.gl/1jBaWG
 Original: [18] http://goo.gl/zZrPxH

   * A Pragmatic Case for Static Typing with Brian Hurt on Vimeo
 (at NY-Haskell)
 Domain: vimeo.com, Score: 27, Comments: 11
 On Reddit: [19] http://goo.gl/uECaaB
 Original: [20] http://goo.gl/59c8Wo

   * Write yourself a Brainfuck in an hour
 Domain: github.com, Score: 26, Comments: 13
 On Reddit: [21] http://goo.gl/lAfzRf
 Original: [22] http://goo.gl/cbJZ7t

Top StackOverflow Questions

   * Is it possible to lazily traverse a recursive data-structure
 with O(1) memory usage, tail-call optimized?
 votes: 10, answers: 4
 Read on SO: [23] http://goo.gl/1qsBKq

   * pattern matching of the form: Option{..} -
 votes: 10, answers: 1
 Read on SO: [24] http://goo.gl/HY3FWY

Until next time,
[25]+Daniel Santa Cruz

References

   1. http://ocharles.org.uk/blog/posts/2013-08-18-asteroids-in-netwire.html
   2.
http://www.reddit.com/r/haskell/comments/1kmes7/building_an_asteroids_clone_in_haskell_using/
   3. http://coldwa.st/e/blog/2013-08-21-Cabal-1-18.html
   4.
http://www.reddit.com/r/haskell/comments/1kslyi/whats_new_in_cabal_118_sandboxes_repl/
   5. http://coldwa.st/e/blog/2013-08-20-Cabal-sandbox.html
   6.
http://www.reddit.com/r/haskell/comments/1kpynl/an_introduction_to_cabal_sandboxes/
   7. http://apfelmus.nfshost.com/blog/2013/08/21-space-invariants.html
   8.
http://www.reddit.com/r/haskell/comments/1ksu0v/reasoning_about_space_leaks_with_space_invariants/
   9. https://www.fpcomplete.com/user/edwardk/bound
  10.
http://www.reddit.com/r/haskell/comments/1knvz2/bound_making_de_bruijn_succ_less_on_school_of/
  11. http://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms
  12.
http://www.reddit.com/r/haskell/comments/1kmods/patternsynonyms_ghc_trac/
  13.
https://www.fpcomplete.com/user/edwardk/revisiting-matrix-multiplication-part-3
  14.
http://www.reddit.com/r/haskell/comments/1kmvs2/revisiting_matrix_multiplication_part_iii/
  15. http://mdswanson.com/blog/2013/08/19/how-to-practice-code-reviews.html
  16.
http://www.reddit.com/r/haskell/comments/1krc6t/great_new_platform_to_increase_practical_code/
  17.
https://www.fpcomplete.com/user/bartosz/basics-of-haskell/10_Error_Handling
  18.
http://www.reddit.com/r/haskell/comments/1ksjt4/bartosz_basic_haskell_error_handling/
  19. https://vimeo.com/72870631
  20.
http://www.reddit.com/r/haskell/comments/1kusbt/a_pragmatic_case_for_static_typing_with_brian/
  21.
https://github.com/quchen/articles/blob/master/write_yourself_a_brainfuck.md
  22.
http://www.reddit.com/r/haskell/comments/1kz39d/write_yourself_a_brainfuck_in_an_hour/
  23.

[Haskell-cafe] Building recent Cabal/cabal-install

2013-08-28 Thread Mateusz Kowalczyk
Greetings café,

There are some problems in Haddock to do with Template Haskell that I
believe are being caused by Cabal. These were apparently addressed in
1.18 which came out recently. ‘Great!’, I thought.

My problem is that I'm unsure how to use 1.18. I'm using GHC HEAD (well,
3 days old now) which is meant to come with Cabal 1.18 (the library) and
in fact it seems to ship with it. Running ‘cabal --version’ however:

 cabal-install version 1.17.0
 using version 1.17.0 of the Cabal library

I'm unsure how to get it to use 1.18. I tried to build cabal-install
from git but that just complains about dependencies not being possible
to resolve: it depends on HTTP which depends on base 4.7 but 4.7 comes
with GHC HEAD!

I am baffled as to how I should go about using 1.18 and would love to
hear from some people who have this up and running.
-- 
Mateusz K.

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