Re: [Haskell-cafe] Monads, do and strictness

2012-01-23 Thread David Barbour
at 6:29 AM, Sebastian Fischer fisc...@nii.ac.jpwrote: On Sun, Jan 22, 2012 at 5:25 PM, David Barbour dmbarb...@gmail.com wrote: The laws for monads only apply to actual values and combinators of the monad algebra You seem to argue that, even in a lazy language like Haskell, equational laws

Re: [Haskell-cafe] Monads, do and strictness

2012-01-23 Thread David Barbour
Space leaks, time leaks, resource leaks, subtle divergence issues when filtering lists, etc. On Mon, Jan 23, 2012 at 11:57 AM, Jake McArthur jake.mcart...@gmail.comwrote: On Mon, Jan 23, 2012 at 10:45 AM, David Barbour dmbarb...@gmail.com wrote: the repeated failures of attempting to model

Re: [Haskell-cafe] [C][enums][newbie] What is natural Haskell representation of such enum?

2012-01-23 Thread David Barbour
If you want a simple translation, use Word8 (from Data.Word) for the type and use Data.Bits for operations on it just like in C++. This would offer you storage efficiency (if stored as a strict field). If you want idiomatic Haskell, constructor of the form: data ObjectType = Object | Item |

Re: [Haskell-cafe] Monads, do and strictness

2012-01-22 Thread David Barbour
, Jan 21, 2012 at 8:09 PM, David Barbour dmbarb...@gmail.com wrote: In any case, I think the monad identity concept messed up. The property: return x = f = f x Logically only has meaning when `=` applies to values in the domain. `undefined` is not a value in the domain. We can define

Re: [Haskell-cafe] Monads, do and strictness

2012-01-22 Thread David Barbour
2012/1/22 MigMit miguelim...@yandex.ru Отправлено с iPad 22.01.2012, в 20:25, David Barbour dmbarb...@gmail.com написал(а): Attempting to shoehorn `undefined` into your reasoning about domain algebras and models and monads is simply a mistake. No. Using the complete semantics — which

Re: [Haskell-cafe] [C][enums][newbie] What is natural Haskell representation of such enum?

2012-01-22 Thread David Barbour
Performing bit-mask operations is possible via the Data.Bits operations (on elements of type Word8 or Word16, etc.). But I must say, it doesn't seem very `natural` in Haskell, nor even in other languages. It crosses lines, binding abstraction to representation in order to improve efficiency. The

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Barbour
As noted, IO is not strict in the value x, only in the operation that generates x. However, should you desire strictness in a generic way, it would be trivial to model a transformer monad to provide it. E.g. data StrictT m a = StrictT (m a) runStrictT :: StrictT m a - m a runStrictT (StrictT

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Barbour
On Sat, Jan 21, 2012 at 10:08 AM, Roman Cheplyaka r...@ro-che.info wrote: * David Barbour dmbarb...@gmail.com [2012-01-21 10:01:00-0800] As noted, IO is not strict in the value x, only in the operation that generates x. However, should you desire strictness in a generic way, it would

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Barbour
On Sat, Jan 21, 2012 at 10:51 AM, David Menendez d...@zednenem.com wrote: The Eval monad has the property: return undefined = const e = e. You can't write `const e` in the Eval monad. From what I can tell, your proposed monads do not. You can't write `const e` as my proposed monad,

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Barbour
meet monad laws - even in strict languages. On Sat, Jan 21, 2012 at 11:02 AM, David Barbour dmbarb...@gmail.com wrote: On Sat, Jan 21, 2012 at 10:51 AM, David Menendez d...@zednenem.comwrote: The Eval monad has the property: return undefined = const e = e. You can't write `const e

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Barbour
On Sat, Jan 21, 2012 at 11:08 AM, Roman Cheplyaka r...@ro-che.info wrote: * David Barbour dmbarb...@gmail.com [2012-01-21 11:02:40-0800] On Sat, Jan 21, 2012 at 10:51 AM, David Menendez d...@zednenem.com wrote: The Eval monad has the property: return undefined = const e = e. You

[Haskell-cafe] Fwd: Monads, do and strictness

2012-01-21 Thread David Barbour
On Sat, Jan 21, 2012 at 11:22 AM, Roman Cheplyaka r...@ro-che.info wrote: * David Barbour dmbarb...@gmail.com [2012-01-21 11:09:43-0800] Logically only has meaning when `=` applies to values in the domain. `undefined` is not a value in the domain. We can define monads - which meet monad laws

Re: [Haskell-cafe] Fwd: Monads, do and strictness

2012-01-21 Thread David Barbour
On Sat, Jan 21, 2012 at 2:24 PM, Roman Cheplyaka r...@ro-che.info wrote: * David Barbour dmbarb...@gmail.com [2012-01-21 12:18:09-0800] `undefined` is not a value in any domain. It isn't a value at all. It's certainly not part of my monad language or algebra. Up to the semantic level

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Barbour
? Here you evaluate the result, and not the computation itself. Wouldn't it be: (StrictT op) = f = op ` seq` StrictT (op = \x - runStrictT (f x)) ?? 2012/1/21 David Barbour dmbarb...@gmail.com On Sat, Jan 21, 2012 at 10:08 AM, Roman Cheplyaka r...@ro-che.infowrote: * David Barbour dmbarb

Re: [Haskell-cafe] How to make asynchronous I/O composable and safe?

2012-01-17 Thread David Barbour
I'd say use of asynchronous exceptions should be a last resort. Developers should be encouraged to explicitly model any event notification system they use. Regards, Dave On Tue, Jan 17, 2012 at 1:42 AM, Simon Marlow marlo...@gmail.com wrote: This is an interesting problem, I think I might

Re: [Haskell-cafe] How to make asynchronous I/O composable and safe?

2012-01-16 Thread David Barbour
I favor a wait-free concurrency model based on the `vat` from E language. Vats can be modeled very easily in Haskell, and in many other languages. I currently use such a vat model for my Haskell projects. I describe aspects of it at a few places: *

Re: [Haskell-cafe] strict, lazy, non-strict, eager

2012-01-16 Thread David Barbour
Full beta-reduction is certainly not strict but also doesn't guarantee terminate even where it is possible (i.e. it might indefinitely unfold a value without making progress). I don't think there is much you can say about non-strictness and termination. Regards, Dave On Mon, Jan 9, 2012 at 3:01

Re: [Haskell-cafe] AFRP is not (necessarily) imperative

2011-12-12 Thread David Barbour
This would make a good blog article... 2011/12/12 Ertugrul Söylemez e...@ertes.de Hello fellows, after a few discussions on IRC and via private mail I feel obligated to point out that arrows and in particular AFRP do not force you to use an imperative style in any way. You can use a style

Re: [Haskell-cafe] A Mascot

2011-11-23 Thread David Barbour
I don't like the lamb at all. But I like the idea of a language mascot. I really like Adam Chlipala's spidurweb: http://www.impredicative.com/ur/ Maybe a lambdacat can volunteer. ;-) Regards, Dave ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] A Mascot

2011-11-23 Thread David Barbour
On Wed, Nov 23, 2011 at 2:53 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 24 November 2011 09:10, David Barbour dmbarb...@gmail.com wrote: I don't like the lamb at all. But I like the idea of a language mascot. I really like Adam Chlipala's spidurweb: That to me is more

Re: [Haskell-cafe] Depth first search

2011-11-08 Thread David Barbour
Major error is in the line of code: `| otherwise = dfs' g y ( v : vis )` You need something closer to: let vsx = dfs' g x (x : vis) in dfs' g v vsx That is, first visit everything you can reach from x, then backtrack to add anything else you can reach from v. This implementation will

Re: [Haskell-cafe] System calls and Haskell threads

2011-11-03 Thread David Barbour
On Thu, Nov 3, 2011 at 8:35 AM, Andreas Voellmy andreas.voel...@gmail.comwrote: I just read Kazu Yamamoto's article on a high performance web server in the latest Monad.Reader, and I came across a statement that doesn't sound correct to me. He says: When a user thread issues a system call, a

Re: [Haskell-cafe] System calls and Haskell threads

2011-11-03 Thread David Barbour
On Thu, Nov 3, 2011 at 10:22 AM, David Barbour dmbarb...@gmail.com wrote: It is correct in context. Mighttpd does not use the -Nx argument to create multiple OS threads, instead uses a `prefork` model that creates separate processes to balance user invocations. Using multiple processes instead

Re: [Haskell-cafe] arr considered harmful

2011-11-01 Thread David Barbour
On Mon, Oct 31, 2011 at 5:33 PM, Ryan Ingram ryani.s...@gmail.com wrote: For example, I would love to be able to use the arrow syntax to define objects of this type: data Circuit a b where Const :: Bool - Circuit () Bool Wire :: Circuit a a Delay :: Circuit a a And ::

Re: [Haskell-cafe] Persistent Concurrent Data Structures

2011-11-01 Thread David Barbour
Several of the Haskell web server frameworks (Yesod, HAppS, etc.) come with persistence support. I believe you're taking the wrong approach here, with respect to `modified concurrently` and the like. What does it mean for a Data.List to be 'modified concurrently'? If you need concurrency, first

Re: [Haskell-cafe] Efficient mutable arrays in STM

2011-10-30 Thread David Barbour
On Sun, Oct 30, 2011 at 6:20 PM, Ben Franksen ben.frank...@online.dewrote: According to the original STM paper the implementation does an equality test, albeit only for pointer equality. It strikes me as bad form to depend on characteristics of `the implementation`. An incremented integer

Re: [Haskell-cafe] MonadPlus versus Alternative

2011-10-29 Thread David Barbour
MonadPlus is `or` semantics, as is Alternative. It does, indeed, reflect the Applicative/Monad difference. On Sat, Oct 29, 2011 at 8:02 PM, Gregory Crosswhite gcrosswh...@gmail.comwrote: Hey everyone, What is the difference between MonadPlus and Alternative? In my mind, it would make sense

Re: [Haskell-cafe] What library package fulfills these requirements?

2011-10-28 Thread David Barbour
Haskore - music generation Yesod, Snap, or HAppS - quick web application Diagrams - easy image composition, 2D GPipe - functional composition of 3D graphics and shaders (similar to Conal Elliott's Vertigo). (cabal - easy installs, downloads, packaging) On Fri, Oct 28, 2011 at 12:06 AM, Joosten,

Re: [Haskell-cafe] Trouble defining `instance Arrow SF'

2011-10-27 Thread David Barbour
On Thu, Oct 27, 2011 at 5:55 AM, Captain Freako capn.fre...@gmail.comwrote: SF.hs:11:10: `' is not a (visible) method of class `Arrow' Failed, modules loaded: none. import Prelude hiding ((.),id) import Control.Category you'll also need to define `instance Category SF`, since that is a

Re: [Haskell-cafe] Trouble defining `instance Arrow SF'

2011-10-27 Thread David Barbour
On Thu, Oct 27, 2011 at 7:07 PM, Captain Freako capn.fre...@gmail.comwrote: Thanks for the reply, David. I tried implementing your suggestions, such that my code now looks like this: While Ross Patterson followed Hughes closely, it was recognized that Category could be separated from Arrow.

Re: [Haskell-cafe] Efficient mutable arrays in STM

2011-10-25 Thread David Barbour
On Tue, Oct 25, 2011 at 10:47 AM, Ben Franksen ben.frank...@online.dewrote: The main question is: does the STM transaction actually see that I changed part of the underlying array, so that the transaction gets re-tried? Or do I have to implement this manually, and if yes: how? Create an

Re: [Haskell-cafe] ANN: diagrams 0.4

2011-10-24 Thread David Barbour
Is there any way to `query` a diagram, i.e. associate data with each pixel for mouse clicks? Or are the composition rules mostly write-only? On Sun, Oct 23, 2011 at 11:47 AM, Brent Yorgey byor...@seas.upenn.eduwrote: I am pleased to announce the release of version 0.4 of diagrams, a

Re: [Haskell-cafe] ANN: diagrams 0.4

2011-10-24 Thread David Barbour
: On Sun, Oct 23, 2011 at 11:06:19PM -0700, David Barbour wrote: Is there any way to `query` a diagram, i.e. associate data with each pixel for mouse clicks? Yes. Every diagram has an associated 'query function', which associates a monoidal value to every point. By default it just

Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-20 Thread David Barbour
On Thu, Oct 20, 2011 at 5:19 AM, Captain Freako capn.fre...@gmail.comwrote: Hi David, I was referring to the `f' in the `runAuto' function, not the `liftAu' function. -db Ah, I see. You quoted one thing and spoke of another, and I got all confused. Keep in mind that functions are arrows

Re: [Haskell-cafe] runStateT execution times measurement baffling

2011-10-20 Thread David Barbour
On Thu, Oct 20, 2011 at 10:38 AM, thomas burt thedwa...@gmail.com wrote: Curiously, the times reported for outside are about 5-8 times as long. What is the cost of putStrLn relative to performing `stuffToDo` a few hundred times? ___ Haskell-Cafe

Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-19 Thread David Barbour
On Wed, Oct 19, 2011 at 8:07 PM, Captain Freako capn.fre...@gmail.comwrote: One more question on the `runAuto' code, John: If I understand the code correctly, `f' is an arrow. Yet, we're using it on the right side of `=' in a simple assignment. How are we getting away with that? Thanks,

Re: [Haskell-cafe] A question about causality in FRP

2011-10-14 Thread David Barbour
On Fri, Oct 14, 2011 at 1:31 AM, Ertugrul Soeylemez e...@ertes.de wrote: David Barbour dmbarb...@gmail.com wrote: If you want first-class behaviors or behavior transformers, those will need a different abstraction than 'nested' behaviors. Nested != First Class. You'd have special

Re: [Haskell-cafe] A question about causality in FRP

2011-10-14 Thread David Barbour
On Fri, Oct 14, 2011 at 3:07 AM, Ertugrul Soeylemez e...@ertes.de wrote: It's not about the laws, it's about losing state. I think you should not accumulate state; the abstraction gives me a fresh arrow each instant, conceptually and pragmatically. But it would not be difficult to create an

Re: [Haskell-cafe] A question about causality in FRP

2011-10-14 Thread David Barbour
On Fri, Oct 14, 2011 at 7:27 AM, Alan Jeffrey ajeff...@bell-labs.comwrote: On 10/13/2011 10:43 PM, David Barbour wrote: On Thu, Oct 13, 2011 at 7:54 AM, Alan Jeffrey ajeff...@bell-labs.com mailto:ajeff...@bell-labs.com** wrote: The `problem` such as it exists: you will be unable to causally

Re: [Haskell-cafe] A question about causality in FRP

2011-10-13 Thread David Barbour
On Thu, Oct 13, 2011 at 7:54 AM, Alan Jeffrey ajeff...@bell-labs.comwrote: A function (f : Beh A - Beh B) is causal whenever it respects =t, i.e. (forall t . a =t b = f a =t f b). Yes. Function outputs only depend on the past values of the input function. Your solutions for double and weird

Re: [Haskell-cafe] Three questions to graphviz

2011-10-10 Thread David Barbour
On Mon, Oct 10, 2011 at 9:44 AM, kaffeepause73 kaffeepaus...@yahoo.dewrote: First of all - thanks a lot for this package, graphviz is an awesome tool and having this interface library is really convenient. There a three point where I could use some help: 1. when I try to create a label with

Re: [Haskell-cafe] Trouble using State Monad.

2011-10-09 Thread David Barbour
On Sun, Oct 9, 2011 at 7:57 PM, Captain Freako capn.fre...@gmail.comwrote: 21 applyFilter :: Filter e a - FilterState - a - (Either e a, FilterState) 22 applyFilter f s x = runState (runEitherT (runFilter f)) s I still don't understand how I'm supposed to feed the input, `x', into the

Re: [Haskell-cafe] Trouble using State Monad.

2011-10-08 Thread David Barbour
On Sat, Oct 8, 2011 at 4:28 PM, Captain Freako capn.fre...@gmail.comwrote: 17 newtype Filter e a = F { * 18 runFilter :: EitherT e (State FilterState) a ** * 19 } deriving (Monad, MonadState FilterState) it compiles, but I can't figure out how I'd feed the input to the filter, in

Re: [Haskell-cafe] Question: Lazy Incremental Evaluation and Haskell?

2011-10-07 Thread David Barbour
Functional Reactive Programming can model this sort of 'change over time' incremental computation, but I doubt you'd get a performance benefit from it unless your operations are considerably more expensive than '+' on numbers. Look into the 'Reactive' library, and Conal Elliott's paper on it

Re: [Haskell-cafe] Question: Lazy Incremental Evaluation and Haskell?

2011-10-07 Thread David Barbour
On Fri, Oct 7, 2011 at 3:17 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: FRP is somewhat orthogonal to incremental computation because FRP is focusing on expressiveness while incremental computation focuses on performance. You can formulate some incremental algorithms in terms of

Re: [Haskell-cafe] Is it possible to represent such polymorphism?

2011-10-02 Thread David Barbour
On Sun, Oct 2, 2011 at 6:04 AM, Du Xi sdiy...@sjtu.edu.cn wrote: --Is it possible to get around this and write the expand function? Of course, x and y may be of different types Not as written, but try HList. http://hackage.haskell.org/package/HList

Re: [Haskell-cafe] Is it possible to represent such polymorphism?

2011-10-02 Thread David Barbour
On Sun, Oct 2, 2011 at 8:45 AM, Du Xi sdiy...@sjtu.edu.cn wrote: Then again , in typeclass definition how can I express the type a-b where a is the type parameter of the class and b is a type deduced from the rules defined in each instance of the class, which varies on a per-instance basis?

Re: [Haskell-cafe] Haskell Cloud and Closures

2011-10-01 Thread David Barbour
On Sat, Oct 1, 2011 at 4:54 AM, Fred Smith ilikequot...@katamail.comwrote: do you know if there is another way either to compute the closure of a function or to serialize it in order to send the computation to another host? You'll need to capture the functions as serializable data while it

Re: [Haskell-cafe] Turn GC off

2011-09-29 Thread David Barbour
On Wed, Sep 28, 2011 at 6:04 AM, Andreas Voellmy andreas.voel...@gmail.comwrote: Sure. I'm writing a server that serves a number of long-lived TCP connections. How many are you looking at? (ROFLSCALEhttp://www.youtube.com/watch?v=majbJoD6fzo?) And how much activity? Do you need real-time

Re: [Haskell-cafe] Turn GC off

2011-09-29 Thread David Barbour
Thank you for the clarification. I had read those papers, but I was under the impression that it was something already part of GHC 7. Regards, Dave On Thu, Sep 29, 2011 at 8:45 PM, austin seipp a...@hacks.yi.org wrote: On Thu, Sep 29, 2011 at 3:14 PM, David Barbour dmbarb...@gmail.com wrote

[Haskell-cafe] Fwd: Is there any way to parametrize a value update using record syntax?

2011-09-06 Thread David Barbour
forgot to CC list. -- Forwarded message -- From: David Barbour dmbarb...@gmail.com Date: 2011/9/6 Subject: Re: [Haskell-cafe] Is there any way to parametrize a value update using record syntax? To: Poprádi Árpád popradi_ar...@freemail.hu 2011/9/6 Poprádi Árpád popradi_ar

Re: [Haskell-cafe] Is there any way to parametrize a value update using record syntax?

2011-09-06 Thread David Barbour
2011/9/6 Erik Hesselink hessel...@gmail.com You can use the fclabels package [1] for this. It makes record labels first class, and also provides functions to update parts of a record in the state monad [2]. That's pretty nifty. Thanks for mentioning it.

Re: [Haskell-cafe] Solving the configuration problem with parametrized modules

2011-09-05 Thread David Barbour
On Mon, Sep 5, 2011 at 3:15 PM, Erik de Castro Lopo mle...@mega-nerd.comwrote: Can't this be mostly solved by putting all these configuration parameters in a struct and then using implicit parameters: Implicit parameters seem like a fair option. And propagating: (?fooConf :: FooConf) =

Re: [Haskell-cafe] Question about data

2011-08-22 Thread David Barbour
In addition to fixing 'Float', you should define the 'Fractional' instance for MathExpression. This would let you use: let pi = 3.14 :: MathExpression So your instance of Fractional would look like: instance Num MathExpression where (+) a b = Add a b (*) a b = Multiply a b (-) a b =

Re: [Haskell-cafe] Error in the asynchronous exception operational semantics

2011-08-09 Thread David Barbour
All you need to know about asynchronous exceptions is: *don't use them!* They're too difficult to reason about, in terms of failure modes and such. Use TVars or MVars instead. On Tue, Aug 9, 2011 at 1:40 PM, Edward Z. Yang ezy...@mit.edu wrote: Hello all, I was recently reading Asynchronous

Re: [Haskell-cafe] Properties for Foldable

2011-07-29 Thread David Barbour
On Fri, Jul 29, 2011 at 1:15 PM, Conal Elliott co...@conal.net wrote: Is there a collection of laws associated with the Foldable class? Or for Traversable? - Conal Judging by the documentation in the source, I think all the laws are in terms of 'toList'...

Re: [Haskell-cafe] Effects of Monads in Parallelisation

2011-07-26 Thread David Barbour
2011/7/26 Burak Ekici ekcbu...@hotmail.com what has been changed after the encapsulation of 'par' function by Eval monad? If you asked to compare the parallelisation via monads with non-monadic manner of it, what could you say? 'Eval' provides some useful discipline and structure. It

Re: [Haskell-cafe] Monad for binary tree data structure

2011-07-23 Thread David Barbour
2011/7/22 Александр kommunist1...@mail.ru How can i make Monad type class instance for this tree? And can i make it on not? You'll apply 'f' to every node in the tree. You'll need some sensible mechanism to merge the resulting trees. You might have an easier time for merging a slightly

Re: [Haskell-cafe] Reactive Programming in Machine Learning

2011-07-23 Thread David Barbour
I have spent several months studying use of generative grammars in multi-agent reactive systems [1] - granted, not FRP in particular, but RDP is reasonably close [2]. This result is, implicitly, a distributed, federated machine-learning system (briefly described at [3]). The 'learning' supports

Re: [Haskell-cafe] OpenGL vs OpenGLRaw

2011-07-23 Thread David Barbour
I'm a bit curious about who might be using GPipe. I've been trying to find a good variation on OpenGL that integrates nicely with reactive programming. Issues such as texture management seem to be rather difficult targets. On Sat, Jul 23, 2011 at 12:06 PM, Jake McArthur

Re: [Haskell-cafe] ANNOUNCE: Haskell in the Cloud (http://quid2.org)

2011-07-22 Thread David Barbour
Any relationship to distributed haskell? http://www.macs.hw.ac.uk/~dsg/gdh/ On Fri, Jul 22, 2011 at 3:00 AM, Pasqualino Titto Assini tittoass...@gmail.com wrote: Fellow Haskeller, Has your strongly typed, quick checked, formally verified, Oleg blessed, higher order monadic code become a

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread David Barbour
On Tue, Jul 19, 2011 at 11:14 PM, yi huang yi.codepla...@gmail.com wrote: 2011/7/20 Eugene Kirpichov ekirpic...@gmail.com reallyUnsafePointerEq#, and it really is as unsafe as it sounds :) Why is it so unsafe? i can't find any documentation on it. I think always compare pointer first is a

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread David Barbour
On Wed, Jul 20, 2011 at 10:40 AM, Chris Smith cdsm...@gmail.com wrote: I have looked up crowbar in a number of dictionaries of slang and informal usage... and still have no idea what you just said. Can you reword it? Crowbars offer 'leverage'. The point, I think, is that if pointer

Re: [Haskell-cafe] How to ensure code executes in the context of a specific OS thread?

2011-07-12 Thread David Barbour
On Tue, Jul 12, 2011 at 2:58 AM, Simon Marlow marlo...@gmail.com wrote: I discovered the real reason we run statements in a separate thread: the GHCi debugger. If the computation stops at a breakpoint, then we have to save the context and resume GHCi, which can only be done if the computation

Re: [Haskell-cafe] Why is (+++) not a functor?

2011-07-12 Thread David Barbour
On Tue, Jul 12, 2011 at 6:55 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: ArrowChoice's (+++) documentation [1] says that this is in general not a functor [1]. What does it mean for (+++) to be or not to be a functor? The same note is made for (***). If you review Ross

Re: [Haskell-cafe] unbuffered raw keyboard input on Windows

2011-07-10 Thread David Barbour
2011/7/10 José Romildo Malaquias j.romi...@gmail.com On Wed, Jul 06, 2011 at 02:48:47PM -0700, David Barbour wrote: You could try the SDL package to support user input. Unfortunatly it does not run on a terminal. http://www.gamedev.net/topic/340894-how-do-i-keep-sdl-from-outputting-stdout

Re: [Haskell-cafe] Call for GUI examples - Functional Reactive Programming

2011-07-09 Thread David Barbour
On Sat, Jul 9, 2011 at 3:58 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: My stream processors are not Arrows, because 'first' cannot be implemented. However, 'arr' and '.' can be implemented. Currently I have build the two tasks into one stream processor. I would like to

Re: [Haskell-cafe] Call for GUI examples - Functional Reactive Programming

2011-07-08 Thread David Barbour
On Thu, Jul 7, 2011 at 11:08 PM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Can GUI programming be liberated from the IO monad? I believe it can be. But is FRP the right way to achieve this? Most of the GUI problems I've ever encountered involve open systems: configuration files,

Re: [Haskell-cafe] Automatic Reference Counting

2011-07-06 Thread David Barbour
On Tue, Jul 5, 2011 at 9:00 PM, steffen steffen.sier...@googlemail.comwrote: The important point about reference counting on idevices is the near realtime performance, since stops for collecting garbage are actually very short in comparison to collecting compilers (despite more frequent).

Re: [Haskell-cafe] How to ensure code executes in the context of a specific OS thread?

2011-07-06 Thread David Barbour
On Wed, Jul 6, 2011 at 8:09 AM, Simon Marlow marlo...@gmail.com wrote: On 06/07/2011 15:42, Jason Dagit wrote: How can I make sure my library works from GHC (with arbitrary user threads) and from GHCI? Right, but usually the way this is implemented is with some cooperation from the main

Re: [Haskell-cafe] Arrow instance of function type [a] - [b]

2011-07-06 Thread David Barbour
On Wed, Jul 6, 2011 at 6:04 AM, Markus Läll markus.l...@gmail.com wrote: Is it possible to define an Arrow instance of list to list functions? import Control.Arrow import Control.Category type X a b = [a] - [b] You need a newtype here. (-) is already an arrow.

Re: [Haskell-cafe] How to ensure code executes in the context of a specific OS thread?

2011-07-06 Thread David Barbour
On Wed, Jul 6, 2011 at 12:52 PM, Simon Marlow marlo...@gmail.com wrote: I think the real issue is that GHC has a different behavior than GHCi, and I think this causes a lot of difficulties for people working on GUI and other FFI integration. Well, GHCi has no main, so it doesn't seem

Re: [Haskell-cafe] unbuffered raw keyboard input on Windows

2011-07-06 Thread David Barbour
You could try the SDL package to support user input. 2011/7/6 José Romildo Malaquias j.romi...@gmail.com Hello. I want to write a Haskell console application (a game) in ghc where the user will interact using the keyboard. I need to read the keys as soon as they are typed and without

Re: [Haskell-cafe] How to ensure code executes in the context of a specific OS thread?

2011-07-03 Thread David Barbour
On Jul 3, 2011, Jason Dagit dag...@gmail.com wrote: to correctly handle GUI events you need to use the original thread allocated to your process to check for events and to call the Cocoa framework functionality. I looked at the threading documentation in Control.Concurrent for GHC and it's

Re: [Haskell-cafe] Why aren't there anonymous sum types in Haskell?

2011-06-22 Thread David Barbour
On Wed, Jun 22, 2011 at 1:25 PM, pipoca eliyahu.ben.mi...@gmail.com wrote: Is there any reason why we don't have either anonymous disjoint union types, or why some of the proposals here (e.g. type (:|:) a b = Either a b ) haven't been implemented, or put into the standard libraries (and

Re: [Haskell-cafe] Data Flow Programming in FP

2011-06-21 Thread David Barbour
On Tue, Jun 21, 2011 at 3:18 AM, Richard Senington sc06...@leeds.ac.ukwrote: I have been looking through the papers by Conal Elliott and Paul Hudak, Hudak's book The Haskell School of Expression (chapters 13,15,17) and the latest version of the Reactive library on Hackage. In the past I

Re: [Haskell-cafe] Why aren't there anonymous sum types in Haskell?

2011-06-21 Thread David Barbour
On Tue, Jun 21, 2011 at 1:36 PM, Matthew Steele mdste...@alum.mit.eduwrote: Yes, Either is to sum types what (,) is to product types. The difference is that there is no anonymous sum type equivalent to (,,) and (,,,) and () and so on, which I think is what the original question is getting

Re: [Haskell-cafe] Why aren't there anonymous sum types in Haskell?

2011-06-21 Thread David Barbour
On Tue, Jun 21, 2011 at 2:24 PM, pipoca eliyahu.ben.mi...@gmail.com wrote: On Jun 21, 4:57 pm, Alexey Khudyakov alexey.sklad...@gmail.com wrote: Types may be same. oops :: Int :+: Int - Int oops Int i = mmm which one? If you were to have your anonymous sum types be a union instead of

Re: [Haskell-cafe] Data Flow Programming in FP

2011-06-20 Thread David Barbour
] http://awelonblue.wordpress.com/2011/05/21/comparing-frp-to-rdp/ Regards, David Barbour ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Conditional IO ?

2011-06-20 Thread David Barbour
On Mon, Jun 20, 2011 at 1:33 AM, Dmitri O.Kondratiev doko...@gmail.comwrote: Thanks! Everything works, and 'when' is really nice. ( I still have only basic monad knowledge, need more time to spend on existing libraries) I heavily use 'when' and 'unless'. ('unless b x' is the same as 'when

Re: [Haskell-cafe] Data Type Inheritance ala OO - Inheritence -- howto best in Haskell ?

2011-06-16 Thread David Barbour
Look into Oleg's HList (heterogeneous list) and OOHaskell http://homepages.cwi.nl/~ralf/HList/ http://homepages.cwi.nl/~ralf/OOHaskell/ On Thu, Jun 16, 2011 at 5:08 AM, kaffeepause73 kaffeepaus...@yahoo.dewrote: Dear all, I'm created a timeSignal datatype as container around a Vector Double

Re: [Haskell-cafe] Can it be proven there are no intermediate useful type classes between Applicative Functors Monads?

2011-06-07 Thread David Barbour
On Sun, Jun 5, 2011 at 12:51 PM, KC kc1...@gmail.com wrote: If new intermediate classes crop up then there would be no point in fixing class (Applicative m) = Monad m where since it would have to be changed if new intermediate classes are found. You might check out a few articles regarding

Re: [Haskell-cafe] Can it be proven there are no intermediate useful type classes between Applicative Functors Monads?

2011-06-07 Thread David Barbour
On Mon, Jun 6, 2011 at 4:05 PM, Casey McCann syntaxgli...@gmail.com wrote: ArrowChoice and ArrowApply are conceptually distinct and I expect there are instances of the former that have no possible instance for the latter. Branching vs. Monad I am much less certain of. For a real-time or

Re: [Haskell-cafe] Can it be proven there are no intermediate useful type classes between Applicative Functors Monads?

2011-06-07 Thread David Barbour
On Tue, Jun 7, 2011 at 6:14 AM, Casey McCann syntaxgli...@gmail.com wrote: On Mon, Jun 6, 2011 at 7:55 PM, David Barbour dmbarb...@gmail.com wrote: Earlier forms of my reactive demand programming model [1] - before I switched to arrows - would qualify. The model has limited side-effects

[Haskell-cafe] Fwd: Work on Collections Processing Arrows?

2011-05-11 Thread David Barbour
[Apparently I forgot to hit reply-all.] Thanks for your response, Adam. On Tue, May 10, 2011 at 1:25 PM, Adam Megacz meg...@cs.berkeley.edu wrote: class (GArrowMap a (**) u c) = GArrowJoin a (**) u c where join :: a d (c r) - a (c d) (c r) I like these; I think you're on the right

Re: [Haskell-cafe] Work on Collections Processing Arrows?

2011-05-11 Thread David Barbour
I wonder if I need something like your use of 'representation' types, i.e. to restrict what sort of elements can be stored in a collection. I've just recently hit on the idea of using a barrier type 'V' to wrap a synchronous value. A 'synchronous value' is one that can be observed at a single

[Haskell-cafe] Work on Collections Processing Arrows?

2011-05-09 Thread David Barbour
Has anyone developed a typeclass model for (Control.Monad.mapM) and related functions for arrows? I've a preliminary model, using Adam Megacz's Generalized Arrows, of the form: class (GArrowDrop a (**) u) = GArrowMap_ a (**) u c where mapA_ :: a d u - a (c d) u class (GArrow a (**) u c) =

[Haskell-cafe] Asynchronous Arrows need Type Specialization - Help!

2011-03-20 Thread David Barbour
I was giving Control.Arrow a try for a reactive programming system. The arrows are agents that communicate by sending and returning time-varying state. Different agents may live in different 'vats' (event-driven threads) to roughly model distributed computing. For the most part, the state varies