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

2011-07-06 Thread Jason Dagit
On Jul 5, 2011 1:04 PM, Jason Dagit dag...@gmail.com wrote: On Tue, Jul 5, 2011 at 12:33 PM, Ian Lynagh ig...@earth.li wrote: On Tue, Jul 05, 2011 at 08:11:21PM +0100, Simon Marlow wrote: In GHCi it's a different matter, because the main thread is running GHCi itself, and all the

[Haskell-cafe] (no subject)

2011-07-06 Thread Ian Childs
Suppose I have two terms s and t of type a and b respectively, and I want to write a function that returns s applied to t if a is an arrow type of form b - c, and nothing otherwise. How do i convince the compiler to accept the functional application only in the correct instance? Thanks,

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

2011-07-06 Thread Simon Marlow
On 05/07/2011 20:33, Ian Lynagh wrote: On Tue, Jul 05, 2011 at 08:11:21PM +0100, Simon Marlow wrote: In GHCi it's a different matter, because the main thread is running GHCi itself, and all the expressions/statements typed at the prompt are run in forkIO'd threads (a new one for each

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

2011-07-06 Thread Simon Marlow
On 05/07/2011 20:38, Jason Dagit wrote: On Tue, Jul 5, 2011 at 12:11 PM, Simon Marlowmarlo...@gmail.com wrote: On 04/07/11 06:02, Jason Dagit wrote: Hello, I'm trying to get some GUI code working on OSX and numerous forums around the internet keep reiterating that on OSX to correctly handle

Re: [Haskell-cafe] function terms

2011-07-06 Thread Henning Thielemann
On Wed, 6 Jul 2011, Ian Childs wrote: Suppose I have two terms s and t of type a and b respectively, and I want to write a function that returns s applied to t if a is an arrow type of form b - c, and nothing otherwise. How do i convince the compiler to accept the functional application only

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

2011-07-06 Thread Simon Marlow
On 06/07/2011 07:37, Jason Dagit wrote: On Jul 5, 2011 1:04 PM, Jason Dagit dag...@gmail.com mailto:dag...@gmail.com wrote: On Tue, Jul 5, 2011 at 12:33 PM, Ian Lynagh ig...@earth.li mailto:ig...@earth.li wrote: On Tue, Jul 05, 2011 at 08:11:21PM +0100, Simon Marlow wrote: In GHCi

Re: [Haskell-cafe] function terms

2011-07-06 Thread Ian Childs
Yes they are Haskell expressions - I called them terms because actually they are GADTs of type Term a and Term b. I can't use type 'b - c' as they are part of a larger pattern. I have a function that returns a witness to 's :: Term a' and 't :: Term b' having the same type, if they do, but

Re: [Haskell-cafe] function terms

2011-07-06 Thread Henning Thielemann
On Wed, 6 Jul 2011, Ian Childs wrote: Yes they are Haskell expressions - I called them terms because actually they are GADTs of type Term a and Term b. I can't use type 'b - c' as they are part of a larger pattern. I have a function that returns a witness to 's :: Term a' and 't :: Term b'

Re: [Haskell-cafe] function terms

2011-07-06 Thread Ian Childs
Term a is meant to be the simply-typed lambda-calculus as a GADT. Then given two terms App (App = l1) r1, and App (App = l2) r2, I want to form App (App = (App l1 l2)) (App r1 r2), but as you can see this will only work if the types of l1 and l2, and r1 and r2, match as detailed

Re: [Haskell-cafe] function terms

2011-07-06 Thread Henning Thielemann
On Wed, 6 Jul 2011, Ian Childs wrote: Term a is meant to be the simply-typed lambda-calculus as a GADT. Then given two terms App (App = l1) r1, and App (App = l2) r2, I want to form App (App = (App l1 l2)) (App r1 r2), but as you can see this will only work if the types of l1 and l2, and r1

Re: [Haskell-cafe] function terms

2011-07-06 Thread Ian Childs
Sorry, that should be (Const =). The GADT is defined as follows: data Var a where MkVar :: (GType a) = String - Var a data LTerm a where Var :: (GType a) = Var a - LTerm a Const :: (GType a) = String - LTerm a (:.) :: (GType a, GType b) = LTerm (a - b) - LTerm a - LTerm b Abs ::

Re: [Haskell-cafe] function terms

2011-07-06 Thread oleg
Ian Childs wrote: I have a function that returns a witness to 's :: Term a' and 't :: Term b' having the same type, if they do, but I am wondering how to extend this to the first argument of an arrow type. Basically you have to write the deconstruct that takes (TRepr a), the witness for type

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

2011-07-06 Thread John Lato
Message: 23 Date: Wed, 06 Jul 2011 10:14:56 +0100 From: Simon Marlow marlo...@gmail.com Subject: Re: [Haskell-cafe] How to ensure code executes in the context of aspecific OS thread? To: Jason Dagit dag...@gmail.com, cvs-...@haskell.org,Haskell Cafe

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

2011-07-06 Thread Markus Läll
Hi! Is it possible to define an Arrow instance of list to list functions? Something like import Control.Arrow import Control.Category type X a b = [a] - [b] instance Category X where id = map Prelude.id g . f = g Prelude.. f instance Arrow X where arr f = map f first f = unzip

Re: [Haskell-cafe] NLP libraries and tools?

2011-07-06 Thread Dmitri O.Kondratiev
Hi, Continuing my search of Haskell NLP tools and libs, I wonder if the following Haskell libraries exist (googling them does not help): 1) End of Sentence (EOS) Detection. Break text into a collection of meaningful sentences. 2) Part-of-Speech (POS) Tagging. Assign part-of-speech information to

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

2011-07-06 Thread Steffen Schuldenzucker
Hi Markus, On 07/06/2011 03:04 PM, Markus Läll wrote: [...] import Control.Arrow import Control.Category type X a b = [a] - [b] instance Category X where id = map Prelude.id g . f = g Prelude.. f instance Arrow X where arr f = map f first f = unzip first f uncurry zip

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

2011-07-06 Thread Brandon Allbery
On Wed, Jul 6, 2011 at 09:43, Steffen Schuldenzucker sschuldenzuc...@uni-bonn.de wrote: Hi Markus, On 07/06/2011 03:04 PM, Markus Läll wrote: [...] import Control.Arrow import Control.Category type X a b = [a] -  [b] instance Category X where    id = map Prelude.id    g . f = g

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

2011-07-06 Thread Jason Dagit
On Wed, Jul 6, 2011 at 2:20 AM, Simon Marlow marlo...@gmail.com wrote: On 05/07/2011 20:38, Jason Dagit wrote: On Tue, Jul 5, 2011 at 12:11 PM, Simon Marlowmarlo...@gmail.com  wrote: On 04/07/11 06:02, Jason Dagit wrote: Hello, I'm trying to get some GUI code working on OSX and numerous

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

2011-07-06 Thread Jason Dagit
On Wed, Jul 6, 2011 at 2:23 AM, Simon Marlow marlo...@gmail.com wrote: On 06/07/2011 07:37, Jason Dagit wrote: On Jul 5, 2011 1:04 PM, Jason Dagit dag...@gmail.com mailto:dag...@gmail.com wrote:     On Tue, Jul 5, 2011 at 12:33 PM, Ian Lynagh ig...@earth.li mailto:ig...@earth.li wrote:  

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

2011-07-06 Thread Simon Marlow
On 06/07/2011 15:42, Jason Dagit wrote: On Wed, Jul 6, 2011 at 2:23 AM, Simon Marlowmarlo...@gmail.com wrote: On 06/07/2011 07:37, Jason Dagit wrote: On Jul 5, 2011 1:04 PM, Jason Dagitdag...@gmail.com mailto:dag...@gmail.com wrote: On Tue, Jul 5, 2011 at 12:33 PM, Ian

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

2011-07-06 Thread Jason Dagit
On Wed, Jul 6, 2011 at 8:09 AM, Simon Marlow marlo...@gmail.com wrote: On 06/07/2011 15:42, Jason Dagit wrote: On Wed, Jul 6, 2011 at 2:23 AM, Simon Marlowmarlo...@gmail.com  wrote: On 06/07/2011 07:37, Jason Dagit wrote: On Jul 5, 2011 1:04 PM, Jason Dagitdag...@gmail.com

Re: [Haskell-cafe] NVIDIA's CUDA and Haskell

2011-07-06 Thread Johannes Waldmann
Trevor L. McDonell tmcdonell at cse.unsw.edu.au writes: hmm... so libcuda and libcudart are in /usr/local/cuda/lib ... actually libcuda is in /usr/lib/nvidia-current , unbeknownst to ./configure. I think this comes from package nvidia-current(-dev) in ubuntu. I could solve this with

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

2011-07-06 Thread Simon Marlow
On 06/07/2011 16:24, Jason Dagit wrote: On Wed, Jul 6, 2011 at 8:09 AM, Simon Marlowmarlo...@gmail.com wrote: On 06/07/2011 15:42, Jason Dagit wrote: On Wed, Jul 6, 2011 at 2:23 AM, Simon Marlowmarlo...@gmail.comwrote: On 06/07/2011 07:37, Jason Dagit wrote: On Jul 5, 2011 1:04 PM,

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

2011-07-06 Thread Jason Dagit
On Wed, Jul 6, 2011 at 8:51 AM, Simon Marlow marlo...@gmail.com wrote: On 06/07/2011 16:24, Jason Dagit wrote: On Wed, Jul 6, 2011 at 8:09 AM, Simon Marlowmarlo...@gmail.com  wrote: On 06/07/2011 15:42, Jason Dagit wrote: On Wed, Jul 6, 2011 at 2:23 AM, Simon Marlowmarlo...@gmail.com  

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 Gábor Lehel
On Wed, Jul 6, 2011 at 5:24 PM, Jason Dagit dag...@gmail.com wrote: On Wed, Jul 6, 2011 at 8:09 AM, Simon Marlow marlo...@gmail.com wrote: On 06/07/2011 15:42, Jason Dagit wrote: On Wed, Jul 6, 2011 at 2:23 AM, Simon Marlowmarlo...@gmail.com  wrote: On 06/07/2011 07:37, Jason Dagit wrote:

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 aspecific OS thread?

2011-07-06 Thread Donn Cave
Quoth Jason Dagit dag...@gmail.com, ... Yes. From my perspective (that of a library writer) that's what makes this tricky in GHCi. I need GHCi's cooperation. From GHCi's perspective it's tricky too. It seems to me that ideally, GHCi would do its thing in a child thread, like the extra

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

2011-07-06 Thread Gábor Lehel
2011/7/6 Gábor Lehel illiss...@gmail.com: On Wed, Jul 6, 2011 at 5:24 PM, Jason Dagit dag...@gmail.com wrote: On Wed, Jul 6, 2011 at 8:09 AM, Simon Marlow marlo...@gmail.com wrote: On 06/07/2011 15:42, Jason Dagit wrote: On Wed, Jul 6, 2011 at 2:23 AM, Simon Marlowmarlo...@gmail.com  wrote:

Re: [Haskell-cafe] NLP libraries and tools?

2011-07-06 Thread wren ng thornton
On 7/6/11 9:27 AM, Dmitri O.Kondratiev wrote: Hi, Continuing my search of Haskell NLP tools and libs, I wonder if the following Haskell libraries exist (googling them does not help): 1) End of Sentence (EOS) Detection. Break text into a collection of meaningful sentences. Depending on how

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

2011-07-06 Thread Gábor Lehel
2011/7/6 Gábor Lehel illiss...@gmail.com: 2011/7/6 Gábor Lehel illiss...@gmail.com: On Wed, Jul 6, 2011 at 5:24 PM, Jason Dagit dag...@gmail.com wrote: On Wed, Jul 6, 2011 at 8:09 AM, Simon Marlow marlo...@gmail.com wrote: On 06/07/2011 15:42, Jason Dagit wrote: On Wed, Jul 6, 2011 at 2:23

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

2011-07-06 Thread Donn Cave
Quoth =?ISO-8859-1?Q?G=E1bor_Lehel?= illiss...@gmail.com, ... Stated another way: I suspect most GUI libraries don't really actually care that you only execute GUI code from the main OS thread, as much as they care that only one (thread-unsafe) GUI function is being called at any given time.

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

2011-07-06 Thread Gábor Lehel
2011/7/6 Donn Cave d...@avvanta.com: Quoth =?ISO-8859-1?Q?G=E1bor_Lehel?= illiss...@gmail.com, ... Stated another way: I suspect most GUI libraries don't really actually care that you only execute GUI code from the main OS thread, as much as they care that only one (thread-unsafe) GUI

Re: [Haskell-cafe] (no subject)

2011-07-06 Thread Thomas DuBuisson
Ian, This requires dynamic typing using Data.Dynamic (for application) and Data.Typeable (to do the typing). Namely, you are asking for the dynApply function: START CODE import Data.Dynamic import Data.Typeable import Control.Monad maybeApp :: (Typeable a, Typeable b, Typeable c) = a - b

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

2011-07-06 Thread Brandon Allbery
2011/7/6 Gábor Lehel illiss...@gmail.com: Hmm. That does seem like a pretty strong disproof. I wonder if my hypothesis is wrong in general, or if this particular library does in fact have other requirements (thread-local storage or such) (and in this case whether my other assumption was wrong

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

2011-07-06 Thread Donn Cave
Quoth Brandon Allbery allber...@gmail.com, ... I don't know about the general case, but OS X does treat the main thread specially here; the (native, not X11) framework sets up the connection to Core Graphics in the main thread before invoking the main program, so you can't make whatever it is

Re: [Haskell-cafe] NLP libraries and tools?

2011-07-06 Thread Dmitri O.Kondratiev
On Wed, Jul 6, 2011 at 8:32 PM, wren ng thornton w...@freegeek.org wrote: On 7/6/11 9:27 AM, Dmitri O.Kondratiev wrote: Hi, Continuing my search of Haskell NLP tools and libs, I wonder if the following Haskell libraries exist (googling them does not help): 1) End of Sentence (EOS)

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

2011-07-06 Thread Simon Marlow
On 06/07/11 17:14, David Barbour wrote: On Wed, Jul 6, 2011 at 8:09 AM, Simon Marlow marlo...@gmail.com mailto: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?

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

2011-07-06 Thread Simon Marlow
On 06/07/11 17:19, Gábor Lehel wrote: On Wed, Jul 6, 2011 at 5:24 PM, Jason Dagitdag...@gmail.com wrote: On Wed, Jul 6, 2011 at 8:09 AM, Simon Marlowmarlo...@gmail.com wrote: On 06/07/2011 15:42, Jason Dagit wrote: On Wed, Jul 6, 2011 at 2:23 AM, Simon Marlowmarlo...@gmail.comwrote:

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] How to ensure code executes in the context of a specific OS thread?

2011-07-06 Thread Jason Dagit
On Wed, Jul 6, 2011 at 12:52 PM, Simon Marlow marlo...@gmail.com wrote: On 06/07/11 17:14, David Barbour wrote: On Wed, Jul 6, 2011 at 8:09 AM, Simon Marlow marlo...@gmail.com mailto:marlo...@gmail.com wrote:    On 06/07/2011 15:42, Jason Dagit wrote:        How can I make sure my library

[Haskell-cafe] unbuffered raw keyboard input on Windows

2011-07-06 Thread José Romildo Malaquias
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 echoing to the console. Although Haskell provides this capability in the standard libraries (using hSetEcho and

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] NLP libraries and tools?

2011-07-06 Thread Aleksandar Dimitrov
On Wed, Jul 06, 2011 at 09:32:27AM -0700, wren ng thornton wrote: On 7/6/11 9:27 AM, Dmitri O.Kondratiev wrote: Hi, Continuing my search of Haskell NLP tools and libs, I wonder if the following Haskell libraries exist (googling them does not help): 1) End of Sentence (EOS) Detection.

Re: [Haskell-cafe] NLP libraries and tools?

2011-07-06 Thread Aleksandar Dimitrov
On Wed, Jul 06, 2011 at 11:04:30PM +0400, Dmitri O.Kondratiev wrote: On Wed, Jul 6, 2011 at 8:32 PM, wren ng thornton w...@freegeek.org wrote: On 7/6/11 9:27 AM, Dmitri O.Kondratiev wrote: Hi, Continuing my search of Haskell NLP tools and libs, I wonder if the following Haskell

Re: [Haskell-cafe] NLP libraries and tools?

2011-07-06 Thread Rogan Creswick
On Wed, Jul 6, 2011 at 3:03 PM, Aleksandar Dimitrov aleks.dimit...@googlemail.com wrote: So you'd use, say, UIMA+OpenNLP to do sentence boundaries, tokens, tags, named-entities whatnot, then spit out some annotated format, read it in with Haskell, and do the logic/magic there. Have you used

Re: [Haskell-cafe] NLP libraries and tools?

2011-07-06 Thread Aleksandar Dimitrov
On Wed, Jul 06, 2011 at 03:14:07PM -0700, Rogan Creswick wrote: Have you used that particular combination yet? I'd like to know the details of how you hooked everything together if that's something you can share. (We're working on a similar Frankenstein at the moment.) These Frankensteins, as

Re: [Haskell-cafe] NLP libraries and tools?

2011-07-06 Thread Richard O'Keefe
On 7/07/2011, at 7:04 AM, Dmitri O.Kondratiev wrote: I am looking for Haskell implementation of sentence tokenizer such as described by Tibor Kiss and Jan Strunk’s in “Unsupervised Multilingual Sentence Boundary Detection”, which is implemented in NLTK: That method is multilingual but

[Haskell-cafe] Haskell Weekly News: Issue 189

2011-07-06 Thread Daniel Santa Cruz
Welcome to issue 189 of the HWN, a newsletter covering developments in the Haskell community during the week of June 26 to July 2, 2011. It seems that it was a pretty quiet week in the mailing list. There were no significant announcements made, and the number of threads was low by

Re: [Haskell-cafe] NLP libraries and tools?

2011-07-06 Thread wren ng thornton
On 7/6/11 5:58 PM, Aleksandar Dimitrov wrote: On Wed, Jul 06, 2011 at 09:32:27AM -0700, wren ng thornton wrote: On 7/6/11 9:27 AM, Dmitri O.Kondratiev wrote: Hi, Continuing my search of Haskell NLP tools and libs, I wonder if the following Haskell libraries exist (googling them does not

Re: [Haskell-cafe] NLP libraries and tools?

2011-07-06 Thread wren ng thornton
On 7/6/11 6:45 PM, Aleksandar Dimitrov wrote: One hint, if you ever find yourself reading in quantitative linguistic data with Haskell: forget lazy IO. Forget strict IO, except your documents aren't ever bigger than a few hundred megs. In case you're not keeping the whole document in memory,

Re: [Haskell-cafe] NLP libraries and tools?

2011-07-06 Thread wren ng thornton
On 7/6/11 8:46 PM, Richard O'Keefe wrote: I've been working over the last year+ on an optimized HMM-based POS tagger/supertagger with online tagging and anytime n-best tagging. I'm planning to release it this summer (i.e., by the end of August), though there are a few things I'd like to polish

Re: [Haskell-cafe] [Haskell-Cafe] Constructive Probability Theory and RandProc's σ-algebras

2011-07-06 Thread David Banas
Hi Edward, Thanks for your interest in `RandProc`. I'm very interested in continuing this conversation with you, but I think I'd better read the papers you recommend, below first, so that I can do so intelligently. ;-) In the mean time, I do have these rather imprecise thoughts: (Please, see

[Haskell-cafe] GHC/ARM registerised port

2011-07-06 Thread Karel Gardas
Hello, Stephen Blackheath, David Terei and me are working together on ARM registerised port of GHC. The port is using LLVM as a code generator and is kind of working already. (GHCi support still missing) If you are curious and would like to try the code, please read last two paragraphs