Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-30 Thread Jan-Willem Maessen
On Sun, Sep 29, 2013 at 9:13 PM, Ryan Newton rrnew...@gmail.com wrote: Thanks, that's interesting to know (re: Fortress). Interestingly, in my Fortress days we looked at both using a split-like interface and at a more foldMap / reduce - like interface, and it seemed like the latter worked

Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-30 Thread Ryan Newton
Oops, this email got stuck in the pipe (flaky internet): foldMap _ Tip = mempty foldMap f (Bin _ _ v l r) = Foldable.foldMap f l `mappend` f v `mappend` Foldable.foldMap f r Btw, from my perspective, one problem with relying on foldMap is that it treats the whole structure uniformly,

Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-29 Thread Mike Izbicki
I've got a Partitionable class that I've been using for this purpose: https://github.com/mikeizbicki/ConstraintKinds/blob/master/src/Control/ConstraintKinds/Partitionable.hs The function called parallel in the HLearn library will automatically parallelize any homomorphism from a Partionable to a

Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-29 Thread Jan-Willem Maessen
On Sat, Sep 28, 2013 at 1:09 PM, Ryan Newton rrnew...@gmail.com wrote: Hi all, We all know and love Data.Foldable and are familiar with left folds and right folds. But what you want in a parallel program is a balanced fold over a tree. Fortunately, many of our datatypes (Sets, Maps)

Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-29 Thread Ryan Newton
Thanks, that's interesting to know (re: Fortress). Interestingly, in my Fortress days we looked at both using a split-like interface and at a more foldMap / reduce - like interface, and it seemed like the latter worked better – it requires a lot less boilerplate for controlling recursion, and

[Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-28 Thread Ryan Newton
Hi all, We all know and love Data.Foldable and are familiar with left folds and right folds. But what you want in a parallel program is a balanced fold over a tree. Fortunately, many of our datatypes (Sets, Maps) actually ARE balanced trees. Hmm, but how do we expose that? It seems like it

Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-28 Thread adam vogt
On Sat, Sep 28, 2013 at 1:09 PM, Ryan Newton rrnew...@gmail.com wrote: Hi all, We all know and love Data.Foldable and are familiar with left folds and right folds. But what you want in a parallel program is a balanced fold over a tree. Fortunately, many of our datatypes (Sets, Maps)

Re: [Haskell-cafe] What am I missing? Cycle in type synonym declarations

2013-08-21 Thread Simon Peyton-Jones
the change... it just needs to be merged in. Simon | -Original Message- | From: Haskell-Cafe [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of David | Fox | Sent: 20 August 2013 22:00 | To: Haskell Cafe | Subject: [Haskell-cafe] What am I missing? Cycle in type synonym declarations

[Haskell-cafe] What am I missing? Cycle in type synonym declarations

2013-08-20 Thread David Fox
This file gives me the error Cycle in type synonym declarations Can anyone tell me why? I'm just trying to write a function to create a type that is a FooT with the type parameter fixed. {-# LANGUAGE TemplateHaskell #-} import Language.Haskell.TH (Q, Dec, TypeQ) data FooT a = FooT a foo ::

Re: [Haskell-cafe] What am I missing? Cycle in type synonym declarations

2013-08-20 Thread jabolopes
Hi, In this case, you have two 'FooT' names: one is the Type and the other is the Constructor. Perhaps Template Haskell is capturing the wrong one inside the quote (probably the constructor). When you have name shadowing, you should always use a lookup function. You can find these lookup

Re: [Haskell-cafe] What am I missing? Cycle in type synonym declarations

2013-08-20 Thread adam vogt
On Tue, Aug 20, 2013 at 5:00 PM, David Fox d...@seereason.com wrote: This file gives me the error Cycle in type synonym declarations Can anyone tell me why? I'm just trying to write a function to create a type that is a FooT with the type parameter fixed. {-# LANGUAGE TemplateHaskell #-}

Re: [Haskell-cafe] What am I missing? Cycle in type synonym declarations

2013-08-20 Thread David Fox
On Tue, Aug 20, 2013 at 2:35 PM, adam vogt vogt.a...@gmail.com wrote: On Tue, Aug 20, 2013 at 5:00 PM, David Fox d...@seereason.com wrote: This file gives me the error Cycle in type synonym declarations Can anyone tell me why? I'm just trying to write a function to create a type that is a

[Haskell-cafe] what is wrong w my IORef Word32 ?

2013-07-18 Thread Joerg Fritsch
All, what is wrong w the below code? I get an type error related to the operation shiftL import Data.Bits import Data.Word import Data.IORef data Word32s = Word32s { x :: IORef Word32 } bitfield :: Word32 bitfield = 0 mkbitfield :: Word32 - IO Word32s mkbitfield i = do the_bf - newIORef i

Re: [Haskell-cafe] what is wrong w my IORef Word32 ?

2013-07-18 Thread Edward Z. Yang
shiftL has the wrong type: Bits a = a - Int - a so it is expecting the value in the IORef to be an Int. Edward Excerpts from Joerg Fritsch's message of Thu Jul 18 10:08:22 -0700 2013: All, what is wrong w the below code? I get an type error related to the operation shiftL import

Re: [Haskell-cafe] what is wrong w my IORef Word32 ?

2013-07-18 Thread Joerg Fritsch
Can I easily fix the modifyIORef statement by swapping something ? --Joerg On Jul 18, 2013, at 7:19 PM, Edward Z. Yang ezy...@mit.edu wrote: shiftL has the wrong type: Bits a = a - Int - a so it is expecting the value in the IORef to be an Int. Edward Excerpts from Joerg Fritsch's

Re: [Haskell-cafe] what is wrong w my IORef Word32 ?

2013-07-18 Thread Taylor Hedberg
Joerg Fritsch, Thu 2013-07-18 @ 19:22:46+0200: Can I easily fix the modifyIORef statement by swapping something ? --Joerg Replace `shiftL` with `flip shiftL` and change the type signature of `sLbitfield` to take an Int instead of an Integer. signature.asc Description: Digital signature

[Haskell-cafe] What does it mean to derive equations of restricted from in Haskell?

2013-07-16 Thread Daryoush Mehrtash
In John Hughes's The Design of Pretty printing library paper, he says: The implementations which we are trying to derive consist of equations of a restricted form. We will derive implementations by proving their constituent equations from the specification. By itself this is no guarantee

Re: [Haskell-cafe] What does it mean to derive equations of restricted from in Haskell?

2013-07-16 Thread Johannes Waldmann
Daryoush Mehrtash dmehrtash at gmail.com writes: What does restricted form mean? non-restricted: e.g., f (f x y) z = f x (f y z)) restricted: the shape of function declarations in Haskell (where lhs is a pattern) definitions are terminating ... non-termination: an equation like f x y = f

[Haskell-cafe] What have happened to haskell.org?

2013-07-15 Thread Kirill Zaborsky
On URL http://haskell.org/ I get starting Apache page and 404 on http://haskell.org/hoogle/ URL with starting www - http://www.haskell.org/ seems to be working but http://www.haskell.org/hoogle/ responds with some ELF file. Kind regards, Kirill Zaborsky

Re: [Haskell-cafe] What have happened to haskell.org?

2013-07-15 Thread Tom Ellis
On Mon, Jul 15, 2013 at 07:19:12AM -0700, Kirill Zaborsky wrote: http://www.haskell.org/hoogle/ responds with some ELF file. After running strings on it, it does seem to be (at least part of) the hoogle binary. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] What have happened to haskell.org?

2013-07-15 Thread Daniel F
The web site is migrating. IRC says: Topic for #haskell: haskell.org in the middle of migration; expect turbulence; use www.haskell.org On Mon, Jul 15, 2013 at 6:19 PM, Kirill Zaborsky qri...@gmail.com wrote: On URL http://haskell.org/ I get starting Apache page and 404 on

Re: [Haskell-cafe] What symbol / atom/ interned-string package is currently preferred?

2013-05-09 Thread Johannes Waldmann
http://hackage.haskell.org/package/intern what does this package do? OK, I can read efficient hash consing but what does it mean exactly? and how would I actually use it? - J.W. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] What symbol / atom/ interned-string package is currently preferred?

2013-05-09 Thread Oliver Charles
On 05/09/2013 12:56 PM, Johannes Waldmann wrote: http://hackage.haskell.org/package/intern what does this package do? OK, I can read efficient hash consing but what does it mean exactly? and how would I actually use it? I can't tell you what it does, but there is an example -

Re: [Haskell-cafe] What symbol / atom/ interned-string package is currently preferred?

2013-05-09 Thread Johannes Waldmann
https://github.com/ekmett/intern/blob/master/examples/Term.hs sure I found this but that still does not say much. I known generally what hash consing is (and that's why I think I might want to use this package) but I don't see what is the (implied) contract for this implementation: It looks

Re: [Haskell-cafe] What symbol / atom/ interned-string package is currently preferred?

2013-05-09 Thread Andrew Cowie
On Thu, 2013-05-09 at 11:56 +, Johannes Waldmann wrote: http://hackage.haskell.org/package/intern what does this package do? OK, I can read efficient hash consing but what does it mean exactly? and how would I actually use it? Hah. I read the same thing and came to exactly the same

[Haskell-cafe] What symbol / atom/ interned-string package is currently preferred?

2013-05-07 Thread Ryan Newton
Hi cafe, I use symbols all the time when manipulating code. I vacillate between using stringtable-atom, symbol, and simple-atom. Unfortunately: - Stringtable-atom is has a broken build right now (GHC 7.6). (Also I've had some crashes with it in the past.) - simple-atom has dependency

Re: [Haskell-cafe] What symbol / atom/ interned-string package is currently preferred?

2013-05-07 Thread Anthony Cowley
On Tue, May 7, 2013 at 2:58 PM, Ryan Newton rrnew...@gmail.com wrote: Hi cafe, I use symbols all the time when manipulating code. I vacillate between using stringtable-atom, symbol, and simple-atom. Unfortunately: Stringtable-atom is has a broken build right now (GHC 7.6). (Also I've had

[Haskell-cafe] What is the process for GSOC?

2013-05-01 Thread Dominic Steinitz
How is it decided which Haskell projects get chosen? Do we discuss them here and take a collective view? Thanks, Dominic. PS I should point out I have an interest in the proposal to port charts to use diagrams (http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/jbracker/1)

Re: [Haskell-cafe] What is the process for GSOC?

2013-05-01 Thread Alp Mestanogullari
No, if the process is the same this year as the previous one, all potential mentors and haskell.org gsoc admins (I think) get to vote on each submission, giving it a score, and then the best N proposals get chosen. On Wed, May 1, 2013 at 10:34 AM, Dominic Steinitz domi...@steinitz.orgwrote:

[Haskell-cafe] what happened to alexAndPred?

2013-04-23 Thread Johannes Waldmann
Hi. I have ghc-7.6.3 and alex-3.0.5. When I build https://github.com/jwaldmann/smt-lib it breaks with Language/SMTLIB/Lexer.x:6:5: Not in scope: `alexAndPred'. It was working with alex-2.3.5. I was going t add Can I constrain the alex version in the cabal file (I recall this is difficult for

[Haskell-cafe] What happened to http://hackage.haskell.org/platform/2010.2.0.0/cabal/haskell-platform-2010.2.0.0.tar.gz?

2013-04-03 Thread Peter Simons
Is it just me or have some of the old Haskell Platform releases disappeared from haskell.org? The 2010.x links from http://www.haskell.org/platform/prior.html also point to non-existent pages. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] What pattern is this (Something.T - IO a) in Sound.ALSA.Sequencer

2013-03-05 Thread Roman Cheplyaka
* Martin Drautzburg martin.drautzb...@web.de [2013-03-04 21:21:30+0100] On Sunday, 3. March 2013 21:11:21 Roman Cheplyaka wrote: Admittedly, programming with callbacks is not very pleasant. So we have an excellent alternative — the continuation monad transformer! This nested code

Re: [Haskell-cafe] What pattern is this (Something.T - IO a) in Sound.ALSA.Sequencer

2013-03-04 Thread Martin Drautzburg
On Sunday, 3. March 2013 21:11:21 Roman Cheplyaka wrote: Admittedly, programming with callbacks is not very pleasant. So we have an excellent alternative — the continuation monad transformer! This nested code something1 $ \x - do something2 $ \y - do

[Haskell-cafe] What pattern is this (Something.T - IO a) in Sound.ALSA.Sequencer

2013-03-03 Thread Martin Drautzburg
Hello all, this was previously posted on Haskell Beginners, but only partially answered. In Sound.ALSA.Sequencer, there are a number of functions which together set up a midi environement (client, port, queue). They all have a type, where the last argument has a type like: (something.T - IO

Re: [Haskell-cafe] What pattern is this (Something.T - IO a) in Sound.ALSA.Sequencer

2013-03-03 Thread Alexander Solla
On Sun, Mar 3, 2013 at 10:28 AM, Martin Drautzburg martin.drautzb...@web.de wrote: Hello all, this was previously posted on Haskell Beginners, but only partially answered. In Sound.ALSA.Sequencer, there are a number of functions which together set up a midi environement (client, port,

Re: [Haskell-cafe] What pattern is this (Something.T - IO a) in Sound.ALSA.Sequencer

2013-03-03 Thread Roman Cheplyaka
Hi Martin, These are called continuations or callbacks. In this case, the term callback seems to fit better, since the result of continuation is an IO action. The common use case for callbacks is when you want to release some resources after the IO action completes. Let's look at the definition

[Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Branimir Maksimovic
In C usual way is to set some bit in integer variable by shifting or oring,and than check flag integer variable by anding with particular flag value.What is Haskell way? Thanks. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread mukesh tiwari
The same as C way. You can import Data.Bits and can use the functions. Prelude import Data.Bits Prelude Data.Bits Data.Bits. Data.Bits... Data.Bits.bitDefault Data.Bits.complementBit Data.Bits.rotate Data.Bits.shift Data.Bits.testBitDefault Data.Bits..|.Data.Bits.bitSize

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Donn Cave
Quoth Branimir Maksimovic bm...@hotmail.com, In C usual way is to set some bit in integer variable by shifting or oring, and than check flag integer variable by anding with particular flag value. What is Haskell way? Of course you may do the very same thing, if you like. I think if there's

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Brandon Allbery
On Tue, Feb 19, 2013 at 10:11 AM, Branimir Maksimovic bm...@hotmail.comwrote: In C usual way is to set some bit in integer variable by shifting or oring, and than check flag integer variable by anding with particular flag value. What is Haskell way? You can do that, but a somewhat more

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Ertugrul Söylemez
Brandon Allbery allber...@gmail.com wrote: In C usual way is to set some bit in integer variable by shifting or oring, and than check flag integer variable by anding with particular flag value. What is Haskell way? You can do that, but a somewhat more idiomatic way would be a list (or,

[Haskell-cafe] What magic has the new parallel io manager done to improve performance?

2013-02-16 Thread yi huang
I'm curious about the design and trade offs in IO manager, I can point out two changes that should boost performance: 1. Run an IO manager thread on each capability. 2. Use ONESHOT flag to save a system call. I wonder is there anything else? It must be interesting. --

[Haskell-cafe] What magic has the new IO manager done to improve performance ?

2013-02-16 Thread yi huang
I' m curious about the design and trade offs behind the new IO manager. I see two changes from the code: 1. Run IO manager thread on each capability. 2. Use ONESHOT flag to save a system call. Is there other interesting things to know? Is it possible to use epoll's ET mode to save even more

Re: [Haskell-cafe] What magic has the new parallel io manager done to improve performance?

2013-02-16 Thread yi huang
Sorry for the duplicate post, please ignore this one. On Sunday, February 17, 2013, yi huang wrote: I'm curious about the design and trade offs in IO manager, I can point out two changes that should boost performance: 1. Run an IO manager thread on each capability. 2. Use ONESHOT flag to

Re: [Haskell-cafe] What magic has the new IO manager done to improve performance ?

2013-02-16 Thread Johan Tibell
Hi, On Saturday, February 16, 2013, yi huang wrote: I' m curious about the design and trade offs behind the new IO manager. I see two changes from the code: 1. Run IO manager thread on each capability. 2. Use ONESHOT flag to save a system call. Is there other interesting things to know?

[Haskell-cafe] What happened to first-class modules?

2013-01-08 Thread Ismael Figueroa Palet
I just read this page http://www.haskell.org/haskellwiki/First-class_module. It seems there was not much no ongoing work on this topic... does somebody know what happened to first-class modules? what are the actual research papers about this topic? Thanks -- Ismael

[Haskell-cafe] what is the purpose of GHC.Exts.lazy?

2012-12-01 Thread jared simpson
docs say: The call '(lazy e)' means the same as e, but lazyhttp://hackage.haskell.org/packages/archive/base/latest/doc/html/GHC-Exts.html#v:lazy has a magical strictness property: it is lazy in its first argument, even though its semantics is strict. why do i want to use magic during

[Haskell-cafe] What is a functional approach to linear algebra routines? I see REPA warns that one must use fusion or risk slow routines.

2012-10-04 Thread KC
Apparently using STUarrays in an imperative fashion is fraught with peril (and the performance of molasses). Casey -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

2012-09-17 Thread Magicloud Magiclouds
Thank you. Will do. On Mon, Sep 17, 2012 at 7:14 AM, Antoine Latter aslat...@gmail.com wrote: On Sun, Sep 16, 2012 at 5:04 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On 15/09/2012, at 5:14 AM, Chris Heller wrote: You might want to have a look at the time-recurrence package:

Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

2012-09-16 Thread Richard O'Keefe
On 15/09/2012, at 5:14 AM, Chris Heller wrote: You might want to have a look at the time-recurrence package: http://hackage.haskell.org/package/time-recurrence For your simple cases you would do something like: Each second: starting (UTCTime ...) $ recur secondly Each minute:

Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

2012-09-16 Thread Antoine Latter
On Sun, Sep 16, 2012 at 5:04 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On 15/09/2012, at 5:14 AM, Chris Heller wrote: You might want to have a look at the time-recurrence package: http://hackage.haskell.org/package/time-recurrence For your simple cases you would do something like:

Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

2012-09-16 Thread Heller Time
Antoine has it right, the language is lifted from the RFC. Chris Heller SAS - Advanced Analytics Teragram Research Development phone: 1-617-576-6800 x54237 mobile: 1-617-460-3643 email: hel...@teragram.com On Sep 16, 2012, at 7:14 PM, Antoine Latter aslat...@gmail.com wrote: On Sun, Sep 16,

Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

2012-09-14 Thread Karl Voelker
On Thu, Sep 13, 2012 at 10:29 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, Simple usage, I could make an instance of Enum to UTCTime, so [utcTime..] could work. But that is so stiff. How if sometimes I want to step by 1 min, sometimes I want to step by 1 sec? So I

Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

2012-09-14 Thread Roman Cheplyaka
Consider using the time-lens package. import Data.Time.Lens import Data.Lens.Common List comprehension style: [modL seconds (+ fromIntegral n) t | n - [0..]] [modL minutes (+ n) t | n - [0..]] (you need fromIntegral for seconds, because it is of fractional type in Data.Time). iterate

Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

2012-09-14 Thread Magicloud Magiclouds
This is nice. Thanks to all. On Fri, Sep 14, 2012 at 4:03 PM, Roman Cheplyaka r...@ro-che.info wrote: Consider using the time-lens package. import Data.Time.Lens import Data.Lens.Common List comprehension style: [modL seconds (+ fromIntegral n) t | n - [0..]] [modL minutes (+ n)

[Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

2012-09-13 Thread Magicloud Magiclouds
Hi, Simple usage, I could make an instance of Enum to UTCTime, so [utcTime..] could work. But that is so stiff. How if sometimes I want to step by 1 min, sometimes I want to step by 1 sec? So I think some way like [ t | addUTCTime last 60 ] could be nice. But I cannot figure it out Any

Re: [Haskell-cafe] What Haskell Records Need

2012-08-03 Thread Jonathan Geddes
Evan Laforge wrote: I consider that a strength of the lens approach. If I say 'set (a.b.c.d) 42 record', 'a', 'b' etc. don't have to be record fields, I can swap them out for other lenses later on. I can also easily precompose, e.g. 'setThis = a . b; setThat = b . c' and encourage people to use

Re: [Haskell-cafe] What Haskell Records Need

2012-08-03 Thread Ryan Ingram
On Fri, Aug 3, 2012 at 10:11 AM, Jonathan Geddes geddes.jonat...@gmail.comwrote: The nice part about the SEC functions is that they compose as regular functions. Lenses are super powerful in that they form a category. Unfortunately using categories other than functions feels a tad unwieldy

Re: [Haskell-cafe] What Haskell Records Need

2012-08-03 Thread Ryan Ingram
Oops, forgot my references [1] Original post: http://www.twanvl.nl/blog/haskell/cps-functional-references [2] polymorphic update support: http://r6.ca/blog/20120623T104901Z.html [3] another post about these: http://comonad.com/reader/2012/mirrored-lenses/ On Fri, Aug 3, 2012 at 1:53 PM, Ryan

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Richard O'Keefe
On 2/08/2012, at 5:34 PM, Jonathan Geddes wrote: Ouch! And that's not even very deeply nested. Imagine 4 or 5 levels deep. It really makes Haskell feel clunky next to `a.b.c.d = val` that you see in other languages. I was taught that this kind of thing violates the Law of Demeter and that an

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Erik Hesselink
Isn't this exactly the problem solved by all the lens packages? Current popular ones are fclabels [0] and data-lens [1]. [0] http://hackage.haskell.org/package/fclabels [1] http://hackage.haskell.org/package/data-lens On Thu, Aug 2, 2012 at 7:34 AM, Jonathan Geddes geddes.jonat...@gmail.com

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Andrew Butterfield
On 2 Aug 2012, at 09:25, Erik Hesselink wrote: Isn't this exactly the problem solved by all the lens packages? Current popular ones are fclabels [0] and data-lens [1]. [0] http://hackage.haskell.org/package/fclabels [1] http://hackage.haskell.org/package/data-lens Not sure what all of

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Andrew Butterfield
Ah yes - the joy of Haskell It so easy to roll your own, rather than search to find someone else's (better/more elegant) solution... :-) On 2 Aug 2012, at 11:41, Erik Hesselink wrote: On Thu, Aug 2, 2012 at 12:30 PM, Andrew Butterfield andrew.butterfi...@scss.tcd.ie wrote: On 2 Aug

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Erik Hesselink
On Thu, Aug 2, 2012 at 12:30 PM, Andrew Butterfield andrew.butterfi...@scss.tcd.ie wrote: On 2 Aug 2012, at 09:25, Erik Hesselink wrote: Isn't this exactly the problem solved by all the lens packages? Current popular ones are fclabels [0] and data-lens [1]. [0]

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Jonathan Geddes
Richard O'Keefe Said: Ouch! And that's not even very deeply nested. Imagine 4 or 5 levels deep. It really makes Haskell feel clunky next to `a.b.c.d = val` that you see in other languages. I was taught that this kind of thing violates the Law of Demeter and that an object should not be

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Thiago Negri
I'm new to Haskell, but I do like your idea. I prefer this as a built-in feature because it will create a standard way of doing this, making the question wich package should I use to get mutatos? lens-foo, lens-bar, monad-lens, lens-lens-foo-bar, ...? simply go away. So, yes, I up-vote your idea

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Evan Laforge
On Thu, Aug 2, 2012 at 9:00 AM, Jonathan Geddes geddes.jonat...@gmail.com wrote: Richard O'Keefe Said: Ouch! And that's not even very deeply nested. Imagine 4 or 5 levels deep. It really makes Haskell feel clunky next to `a.b.c.d = val` that you see in other languages. I was taught that

[Haskell-cafe] What Haskell Records Need

2012-08-01 Thread Jonathan Geddes
Greetings, tl;dr - What Haskell Records need are semantic editor combinators for free. I know this is yet another Record proposal among many, but none of them out there strike me as being exactly what I want in Haskell. Take the following types from a contrived example. type Salary = Integer

Re: [Haskell-cafe] What does unpacking an MVar really mean?

2012-07-31 Thread Bertram Felgenhauer
Leon Smith wrote: I am familiar with the source of Control.Concurrent.MVar, and I do see {-# UNPACK #-}'ed MVars around, for example in GHC's IO manager. What I should have asked is, what does an MVar# look like? This cannot be inferred from Haskell source; though I suppose I could

Re: [Haskell-cafe] What does unpacking an MVar really mean?

2012-07-31 Thread Leon Smith
On Tue, Jul 31, 2012 at 7:37 AM, Bertram Felgenhauer bertram.felgenha...@googlemail.com wrote: Note that MVar# itself cannot be unpacked -- the StgMVar record will always be a separate heap object. One could imagine a couple of techniques to unpack the MVar# itself, and was curious if GHC

[Haskell-cafe] What does unpacking an MVar really mean?

2012-07-30 Thread Leon Smith
I admit I don't know exactly how MVars are implemented, but given that they can be aliased and have indefinite extent, I would think that they look something vaguely like a cdatatype ** var, basically a pointer to an MVar (which is itself a pointer, modulo some other things such as a thread

Re: [Haskell-cafe] What does unpacking an MVar really mean?

2012-07-30 Thread Ryan Ingram
I'm not sure I totally understand your question about 'unpacking' an MVar, but I'm going to assume you mean data structures that use the {-# UNPACK #-} pragma, like in Control.Concurrent.Future [1] and Control.Concurrent.NamedLock [2]. Here is how MVar is defined in GHC [3]: data MVar a =

Re: [Haskell-cafe] What does unpacking an MVar really mean?

2012-07-30 Thread Leon Smith
Let me clarify a bit. I am familiar with the source of Control.Concurrent.MVar, and I do see {-# UNPACK #-}'ed MVars around, for example in GHC's IO manager. What I should have asked is, what does an MVar# look like? This cannot be inferred from Haskell source; though I suppose I could

[Haskell-cafe] What is the surefire way to handle all exceptions and make sure the program doesn't fail?

2012-07-17 Thread Yifan Yu
First of all, apologise if the question is too broad. The background goes like this: I've implemented a server program in Haskell for my company intended to replace the previous one written in C which crashes a lot (and btw the technology of the company is exclusively C-based). When I chose

Re: [Haskell-cafe] What is the surefire way to handle all exceptions and make sure the program doesn't fail?

2012-07-17 Thread Bardur Arantsson
On 07/17/2012 08:34 AM, Yifan Yu wrote: First of all, apologise if the question is too broad. The background goes like this: I've implemented a server program in Haskell for my company intended to replace the previous one written in C which crashes a lot (and btw the technology of the company

Re: [Haskell-cafe] What is the surefire way to handle all exceptions and make sure the program doesn't fail?

2012-07-17 Thread Christopher Done
On 17 July 2012 22:10, Bardur Arantsson s...@scientician.net wrote: On 07/17/2012 08:34 AM, Yifan Yu wrote: I can only tell if I browse the source code. So the question is, how can I determine all the exceptions that can be thrown by a given function? Look at its source. Not sure that's the

Re: [Haskell-cafe] What is the surefire way to handle all exceptions and make sure the program doesn't fail?

2012-07-17 Thread Bardur Arantsson
On 07/17/2012 10:17 PM, Christopher Done wrote: On 17 July 2012 22:10, Bardur Arantsson s...@scientician.net wrote: On 07/17/2012 08:34 AM, Yifan Yu wrote: I can only tell if I browse the source code. So the question is, how can I determine all the exceptions that can be thrown by a given

Re: [Haskell-cafe] What is the surefire way to handle all exceptions and make sure the program doesn't fail?

2012-07-17 Thread Ertugrul Söylemez
Hello there Yifan, exception handling should be done on a per-context basis, where the developer establishes the notion of context. Most of the time this boils down to releasing resources: forkIO (doStuffWith h `finally` hClose h) In more complicated scenarios, where you actually need to

Re: [Haskell-cafe] What is the surefire way to handle all exceptions and make sure the program doesn't fail?

2012-07-17 Thread Yifan Yu
On Wed, Jul 18, 2012 at 4:10 AM, Bardur Arantsson s...@scientician.netwrote: The most robust way is probably to use a completely independent supervisor program, e.g. upstart, systemd, runit, etc. These usually have facilities for restarting the supervised program, and a rate limit on exactly

Re: [Haskell-cafe] What is the surefire way to handle all exceptions and make sure the program doesn't fail?

2012-07-17 Thread Yifan Yu
On Wed, Jul 18, 2012 at 7:05 AM, Ertugrul Söylemez e...@ertes.de wrote: exception handling should be done on a per-context basis, where the developer establishes the notion of context. Most of the time this boils down to releasing resources: forkIO (doStuffWith h `finally` hClose h)

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-07-16 Thread Magicloud Magiclouds
too. Chris -Original Message- From: Magicloud Magiclouds [mailto:magicloud.magiclo...@gmail.com] Sent: 01 June 2012 02:01 To: Chris Dornan Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? I see. Although I am using a UTF-8 environment, but all

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-07-16 Thread Lars Viklund
On Thu, Jul 12, 2012 at 09:41:43AM +0800, Magicloud Magiclouds wrote: Sorry for the attachments. They are wireshark files. May I suggest not sending multi-megabyte files of limited interest down a widely subscribed list? Contrary to popular belief, bandwidth, time and spool storage isn't free.

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-07-16 Thread Magicloud Magiclouds
Sorry for that. The problem got solved yesterday. On Mon, Jul 16, 2012 at 6:01 PM, Lars Viklund z...@acc.umu.se wrote: On Thu, Jul 12, 2012 at 09:41:43AM +0800, Magicloud Magiclouds wrote: Sorry for the attachments. They are wireshark files. May I suggest not sending multi-megabyte files of

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-07-11 Thread Magicloud Magiclouds
: Magicloud Magiclouds [mailto:magicloud.magiclo...@gmail.com] Sent: 31 May 2012 02:47 To: Chris Dornan Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? Hi, I have compared the files. The .o-es are exactly the same. The .hi-s are different. The interface

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-07-11 Thread Magicloud Magiclouds
...@gmail.com] Sent: 01 June 2012 02:01 To: Chris Dornan Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? I see. Although I am using a UTF-8 environment, but all string I was using were ASCIIs. If it is not too much trouble, may I have your LDAP compiled

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-14 Thread Magicloud Magiclouds
OK. I am totally confused here. Why Couldn't match expected type `Jobs k e a' with actual type `M.Map k0 b0' 9|data JobInfo a e = (Exception e) = 10| JobInfo { jobId :: ThreadId 11| , result :: MVar (Either e a) } 12| 13|type Jobs k e a = (Ord k,

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-14 Thread Magicloud Magiclouds
Sorry, the last 'a' of line 22 is 'b'. On Thu, Jun 14, 2012 at 3:19 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: OK. I am totally confused here. Why Couldn't match expected type `Jobs k e a' with actual type `M.Map k0 b0'  9|data JobInfo a e = (Exception e) = 10|        

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-14 Thread Magicloud Magiclouds
And line 14, should be JobInfo a e. I must be too sleepy On Thu, Jun 14, 2012 at 3:30 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Sorry, the last 'a' of line 22 is 'b'. On Thu, Jun 14, 2012 at 3:19 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: OK. I am

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-14 Thread Arlen Cuss
Hi Magicloud, The indentation has been lost in the mail. Could you post your code (preferably without line numbers) on hpaste.org or similar? —A On Thursday, 14 June 2012 at 5:33 PM, Magicloud Magiclouds wrote: And line 14, should be JobInfo a e. I must be too sleepy On Thu, Jun

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-14 Thread Magicloud Magiclouds
Sorry, the full code is here: http://hpaste.org/69972 On Fri, Jun 15, 2012 at 7:09 AM, Arlen Cuss a...@len.me wrote: Hi Magicloud, The indentation has been lost in the mail. Could you post your code (preferably without line numbers) on hpaste.org or similar? —A On Thursday, 14 June 2012

[Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Magicloud Magiclouds
Hi, I've forgotten this. This is OK: type Job k a = Map k a And this is OK: {-# LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms? type Job = forall a. forall k. Map k a Then how to write it like this? type Job = Map k a -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com.

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Ivan Lazar Miljenovic
On 13 June 2012 19:59, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi,  I've forgotten this.  This is OK: type Job k a = Map k a  And this is OK: {-# LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms? type Job = forall a. forall k. Map k a  Then how to write it like this?

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Ismael Figueroa Palet
Do you want to hide the specific types of the job? Presumably to then define a type JobList = [Job] ? You can do that with the ExistentialQuantification extension. type Job = forall k a. Map k a type JobList = [Job] ?? Note you can't unpack the types k a once you have hidden them. But the

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Daniel Peebles
That doesn't require existential quantification, but it'll need Rank-2 types if you ever do anything with Job. Unfortunately, a universally quantified Job like what you wrote (or what Magicloud seems to want) is only inhabited by the empty Map. An existentially quantified Job, as you might get

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Yves Parès
Mmmmh... no, to do that you need ImpredicativeTypes (which is I believe about to be deprecated). You have to declare Job a data, not a type, and use ExistentialQuantification. 2012/6/13 Ismael Figueroa Palet ifiguer...@gmail.com Do you want to hide the specific types of the job? Presumably to

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Magicloud Magiclouds
Thank you all. I just want to wrap some complex types. So I learn from all info above, I still have to use forall explicitly On Wed, Jun 13, 2012 at 9:19 PM, Yves Parès yves.pa...@gmail.com wrote: Mmmmh... no, to do that you need ImpredicativeTypes (which is I believe about to be

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Magicloud Magiclouds
Hi there, Thanks for the reply. To be clear, all I want is to avoid having to type type variables all over the place. What should I do? My original code with RankNTypes and ImpredicativeTypes does not work The type Job = forall k a. M.Map k a works now. But function uses it does not.

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Arlen Cuss
(resending to café, turns out I wasn't subbed from this address.) Hi Magicloud, This is correct; because you've hidden the type-variables away by universally quantifying them, there's no more level of specificity you can get back *out* of them than just some kind of Map (Job = M.Map k b, where

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Magicloud Magiclouds
OK. I think I understand a little. I use Job here just wants to simplify the code. And since I provide the function as library, I cannot decide what exact type k is. What should I do? On Thu, Jun 14, 2012 at 11:23 AM, Arlen Cuss a...@len.me wrote: (resending to café, turns out I wasn't subbed

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Ivan Lazar Miljenovic
On 14 June 2012 14:20, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: OK. I think I understand a little. I use Job here just wants to simplify the code. And since I provide the function as library, I cannot decide what exact type k is. What should I do? Do you know what the type

  1   2   3   4   5   6   7   8   9   10   >