Re: [Haskell-cafe] Foreign.Erlang help

2012-12-25 Thread Alexander Alexeev
First of all, you can write usual TCP server in Haskell and use it from Erlang. It would be handy to use some widely used protocol, like Memcached or Redis. If in some reason you want to use Foreign.Erlang, make sure that you are using the same cookie and the same node name type (short or

Re: [Haskell-cafe] How to fold on types?

2012-12-25 Thread Тимур Амиров
Try folding over data type constructor with $? вторник, 25 декабря 2012 г. пользователь Magicloud Magiclouds писал: Forgot to mention, solution without TemplateHaskell. On Tue, Dec 25, 2012 at 4:59 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com javascript:_e({}, 'cvml',

Re: [Haskell-cafe] How to fold on types?

2012-12-25 Thread Тимур Амиров
Thinking from subway (: foldl ($) LongDef values ? вторник, 25 декабря 2012 г. пользователь Тимур Амиров писал: Try folding over data type constructor with $? вторник, 25 декабря 2012 г. пользователь Magicloud Magiclouds писал: Forgot to mention, solution without TemplateHaskell. On Tue,

Re: [Haskell-cafe] How to fold on types?

2012-12-25 Thread oleg
Magiclouds asked how to build values of data types with many components from a list of components. For example, suppose we have data D3 = D3 Int Int Int deriving Show v3 = [1::Int,2,3] How can we build the value D3 1 2 3 using the list v3 as the source for D3's fields? We can't

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-25 Thread timothyhobbs
This seems like a bug in GHC. But it has nothing to do with MVars.  I've narrowed this down and filed a bug report here: http://hackage.haskell.org/trac/ghc/ticket/7528 Timothy -- Původní zpráva -- Od: Yuras Shumovich shumovi...@gmail.com Datum: 24. 12. 2012 Předmět: Re:

Re: [Haskell-cafe] ghc-heap-view now with recursive pretty-printing

2012-12-25 Thread Thomas Schilling
On 21 December 2012 11:16, Joachim Breitner m...@joachim-breitner.de wrote: Prelude :script /home/jojo/.cabal/share/ghc-heap-view-0.4.0.0/ghci Prelude let x = [1..10] Prelude x [1,2,3,4,5,6,7,8,9,10] Prelude :printHeap x _bh [S# 1,S# 2,S# 3,S# 4,S# 5,S# 6,S# 7,S# 8,S# 9,S# 10] Note that

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-25 Thread Corentin Dupont
Hi Brandon, indeed in my example if you add: *b - evaluate a* after the definition of a it works. However, in my original program it doesn't work, I suppose because I interpret the user submitted code (here *let (a::String) = a * for the example) via Hint and Hint-server, and the interpretation

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-25 Thread Corentin Dupont
Great, with me compiled with ghc -threaded the bug shows up. However, runnning main in ghci doesn't show the bug (it finishes correctly). I have GHC 7.4.1. Corentin On Tue, Dec 25, 2012 at 3:34 PM, timothyho...@seznam.cz wrote: This seems like a bug in GHC. But it has nothing to do with MVars.

Re: [Haskell-cafe] ghc-heap-view now with recursive pretty-printing

2012-12-25 Thread Joachim Breitner
Hi, Am Dienstag, den 25.12.2012, 16:58 +0100 schrieb Thomas Schilling: On 21 December 2012 11:16, Joachim Breitner m...@joachim-breitner.de wrote: Prelude :script /home/jojo/.cabal/share/ghc-heap-view-0.4.0.0/ghci Prelude let x = [1..10] Prelude x [1,2,3,4,5,6,7,8,9,10] Prelude

Re: [Haskell-cafe] How to fold on types?

2012-12-25 Thread adam vogt
{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables #-} Hi MagicCloud, A worse, but perhaps simpler alternative to Oleg's solution uses Data.Dynamic: import Data.Dynamic data LongDec a = LongDec a a a a a a a a deriving (Show, Typeable) values = abcdefgh mkLongDec :: forall a.

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-25 Thread timothyhobbs
I'm not sure that there is anything great about this bug.  It seems to me to be a rather severe demonstration of a somewhat already known design flaw in the runtime :( Could you please comment on the actual bug rather than replying here so that the devs see that this behaviour has been

Re: [Haskell-cafe] Substituting values

2012-12-25 Thread Radical
Hey Petr, On Sat, Dec 22, 2012 at 9:52 AM, Petr P petr@gmail.com wrote: I think you need something wha Scala has - the ability to create a partial function from a case expression. In Scala you could write def update[A](f: PartialFunction[A,A])(v: A): A = f.orElse({ case x = x } :

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-25 Thread Yuras Shumovich
Hi, AFAIK it is (partially?) fixed in HEAD, see http://hackage.haskell.org/trac/ghc/ticket/367 It works for me with -fno-omit-yields Thanks, Yuras On Tue, 2012-12-25 at 19:35 +0100, timothyho...@seznam.cz wrote: I'm not sure that there is anything great about this bug. It seems to me to be

Re: [Haskell-cafe] How to fold on types?

2012-12-25 Thread Timon Gehr
On 12/25/2012 09:59 AM, Magicloud Magiclouds wrote: Say I have things like: data LongDec = LongDef a b c ... x y z values = [ 'a', 'b', 'c', ... 'x', 'y', 'z' ] Now I want them to be LongDef 'a' 'b' 'c' ... 'x' 'y' 'z'. In form, this is something like folding. But since the type changes, so

Re: [Haskell-cafe] How to fold on types?

2012-12-25 Thread Magicloud Magiclouds
You guys are great! Thanks. On Wed, Dec 26, 2012 at 9:04 AM, Timon Gehr timon.g...@gmx.ch wrote: On 12/25/2012 09:59 AM, Magicloud Magiclouds wrote: Say I have things like: data LongDec = LongDef a b c ... x y z values = [ 'a', 'b', 'c', ... 'x', 'y', 'z' ] Now I want them to be LongDef