[Haskell-cafe] restricted existential datatypes

2007-01-11 Thread oleg
Misha Aizatulin wrote > I am using existential boxes like > > data Box cxt = forall a . Sat (cxt a) => Box a > here Sat is taken from [1]: > > class Sat a where dict :: a > The result is a box type which can have variable context imposed on > its contents. What I noticed is that sometimes I

Re: [Haskell-cafe] CTRL+C in ghci.exey

2007-01-11 Thread John Ky
Hi Stefan, It doesn't work for me. I'm running GHC 6.6 on Windows XP. The computation stops, but I don't get my prompt back. C:\>ghci ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.o

Re: [Haskell-cafe] CTRL+C in ghci.exe

2007-01-11 Thread Yang
yeah, at least that's what ctrl-c already does for me... i'm using ghc-6.6. yang On 1/11/07, John Ky newhoggy-at-. |haskell-cafe| <...> wrote: Hi, Is it possible to use CTRL+C or equivalent to interrupt a computation or I/O and return to the ghci prompt? Thanks -John __

Re: [Haskell-cafe] CTRL+C in ghci.exey

2007-01-11 Thread Stefan O'Rear
On Fri, Jan 12, 2007 at 05:07:04PM +1100, John Ky wrote: > Hi, > > Is it possible to use CTRL+C or equivalent to interrupt a computation or I/O > and return to the ghci prompt? Yes. [EMAIL PROTECTED]:~/lb-sorear$ ghci ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Inte

[Haskell-cafe] CTRL+C in ghci.exe

2007-01-11 Thread John Ky
Hi, Is it possible to use CTRL+C or equivalent to interrupt a computation or I/O and return to the ghci prompt? Thanks -John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] UDP client/server

2007-01-11 Thread John Ky
Nevermind, I just got the client to work: echoClient :: IO () echoClient = withSocketsDo $ do sock <- socket AF_INET Datagram 0 n <- sendTo sock "hi" (SockAddrInet echoPort 0x0107f) return () Thanks everyone for your help. -John On 1/12/07, John Ky <[EMAIL PROTECTED] > wrote:Hi,

[Haskell-cafe] MapTuple is possible and easy

2007-01-11 Thread oleg
Marco Tu'lio Gontijo e Silva wrote: > is there a way to defined something as a map to use in tuples? Yes, it is: and it is quite easy and straightforward. Udo Stenzel > since c would be a variable that ranges over type classes, and that > doesn't exist. Of course it does: please see below (as w

Re: [Haskell-cafe] State monad strictness - how?

2007-01-11 Thread John Meacham
incidentally, I made a very strict and unboxed version of the RWS monad, since it is a darn useful one in jhc. right now, it only implements the things I needed, but it might be useful to include somewhere common and expanded on http://repetae.net/dw/darcsweb.cgi?r=jhc;a=headblob;f=/Util/RWS.hs

Re: [Haskell-cafe] MissingH: profiler support?

2007-01-11 Thread Spencer Janssen
The typical way to add profiling support to a Cabal lib is to add -p at configure time (ie "runhaskell Setup.hs configure -p"). Have you tried this? Cheers, Spencer Janssen On Jan 8, 2007, at 4:13 PM, Chris Eidhof wrote: Hey all, I'm trying to profile my application, which makes use of

[Haskell-cafe] Re: Resending: MissingH: profiler support?

2007-01-11 Thread John Goerzen
On 2007-01-11, Chris Eidhof <[EMAIL PROTECTED]> wrote: > Hey, > > does anyone know about this? Resending as I got no replies (yet) ;) Just for the record, I have no idea; I've never really used profiling and couldn't figure out how to make it work in general (at least not in a short amount of time

Re: [Haskell-cafe] UDP client/server

2007-01-11 Thread John Ky
Hi, What's wrong with my UDP client? echoClient :: IO () echoClient = withSocketsDo $ do putStrLn "[a]" sock <- socket AF_INET Datagram 0 putStrLn "[b]" connect sock (SockAddrInet 9900 iNADDR_ANY) putStrLn "[c]" n <- send sock "hi" putStrLn "[d]" return () I get: *Main>

[Haskell-cafe] advice on architecting a library (and haskell software in general)

2007-01-11 Thread Yang
hi all, i'm looking for advice on how to architect a simple widget library for vty/hscurses, but these beginner-level questions should apply to haskell applications in general. input/requests on any aspect of my design would be greatly appreciated - in return perhaps you'll get something you'd act

[Haskell-cafe] Re: Monad Set via GADT

2007-01-11 Thread Benjamin Franksen
Jim Apple wrote: > On 1/3/07, Roberto Zunino <[EMAIL PROTECTED]> wrote: >> 1) Why the first version did not typececk? > 1) Class constraints can't be used on pattern matching. They ARE > restrictive on construction, however. This is arguably bug in the > Haskell standard. It is fixed in GHC HEAD fo

Re: [Haskell-cafe] mapTuple (intersection types?)

2007-01-11 Thread Greg Buchholz
Udo Stenzel wrote: > Marco T?lio Gontijo e Silva wrote: > > is there a way to defined something as a map to use in tuples? I tried > > this: > > > > mapTuple f (a, b) = (f a, f b) > > > > But the type inferred to it is not as generic as I wanted: > > > > mapTuple :: (t -> t1) -> (t, t) -> (t1, t

Re: [Haskell-cafe] an advanced foldification problem

2007-01-11 Thread Spencer Janssen
Take this obscure function: \begin{code} func :: (a -> a -> Maybe a) -> a -> [a] -> [a] func f s0 xs0 = foldr (\x xs s -> maybe (xs s) ((x:) . xs) (f s x)) return xs0 s0 \end{code} And mergeGroupToList becomes: \begin{code} mergeGroupToList g xs = func mergeGroups g xs \end{code} Cheers, Spe

[Haskell-cafe] building hare on ghc-6.6

2007-01-11 Thread Yang
how do i build hare on ghc-6.6? after removing all references to package lang from myghc--make, i get: RefacUtils.hs:54:5: parse error on input `HasModName' this just seems like a normal class being exported. the makefile proceeds past this to build a bunch of other files fine. if i ignore this

Resending: [Haskell-cafe] MissingH: profiler support?

2007-01-11 Thread Chris Eidhof
Hey, does anyone know about this? Resending as I got no replies (yet) ;) Thanks, -chris On 8 Jan, 2007, at 23:13 , Chris Eidhof wrote: Hey all, I'm trying to profile my application, which makes use of MissingH. But when compiling with -prof -auto-all, I get the following error: Language

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread Udo Stenzel
Marco Túlio Gontijo e Silva wrote: > is there a way to defined something as a map to use in tuples? I tried > this: > > mapTuple f (a, b) = (f a, f b) > > But the type inferred to it is not as generic as I wanted: > > mapTuple :: (t -> t1) -> (t, t) -> (t1, t1) What you seem to want to do is im

Re: [Haskell-cafe] some way to reverse engineer lambda expressionsout of the debugger?

2007-01-11 Thread Claus Reinke
Looks very nice! thanks!-) it is far from a full-blown solution to the question in the subject, but it has its uses. However, I'm doing my learning on ghci and got an error when I tried to load it. Is this hugs only, or should I try harder? I was using Hugs when I wrote that, but it wor

Re: [Haskell-cafe] some way to reverse engineer lambda expressions out of the debugger?

2007-01-11 Thread Thomas Hartman
Looks very nice! However, I'm doing my learning on ghci and got an error when I tried to load it. Is this hugs only, or should I try harder? 2007/1/11, Malcolm Wallace <[EMAIL PROTECTED]>: Bulat Ziganshin <[EMAIL PROTECTED]> wrote: > tphyahoo wrote: > > > *UnixTools> explodeLambda( map (*) [1

Re: [Haskell-cafe] an advanced foldification problem

2007-01-11 Thread Henning Thielemann
On Thu, 11 Jan 2007, Seth Gordon wrote: > I have a data type "Group", representing a group of geographic > information that is all referring to the same location, and a function > "mergeGroups" that tries to merge two groups: > > mergeGroups :: Group -> Group -> Maybe Group > > Then I have

Re: [Haskell-cafe] some way to reverse engineer lambda expressions out of the debugger?

2007-01-11 Thread Malcolm Wallace
Bulat Ziganshin <[EMAIL PROTECTED]> wrote: > tphyahoo wrote: > > > *UnixTools> explodeLambda( map (*) [1,2] ) > >[(\x ->> 1*x),(\x -> 2*x)] Have a play with this, from Claus Reinke: http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/R.hs Regards, Malcolm

[Haskell-cafe] an advanced foldification problem

2007-01-11 Thread Seth Gordon
I have a data type "Group", representing a group of geographic information that is all referring to the same location, and a function "mergeGroups" that tries to merge two groups: mergeGroups :: Group -> Group -> Maybe Group Then I have a function "mergeGroupToList" that tries to merge its fi

Re: Re[2]: [Haskell-cafe] State monad strictness - how?

2007-01-11 Thread Josef Svenningsson
On 1/11/07, Yitzchak Gale <[EMAIL PROTECTED]> wrote: Josef Svenningsson wrote: >>> Take the state monad for example. Should it be >>> strict or lazy in the state that it carries >>> around? What about the value component? >>> ...both strict and lazy variants are useful. I wrote: >> Are those rea

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread Marco Túlio Gontijo e Silva
Em Qui, 2007-01-11 às 16:51 +0100, minh thu escreveu: > 2007/1/11, Marco Túlio Gontijo e Silva <[EMAIL PROTECTED]>: > > Em Qui, 2007-01-11 às 16:14 +0100, minh thu escreveu: > > > you might want invistigate "heterogeneous lists" : in your case, it's > > > "heterogeneous typle". > > > > But aren't

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread David House
On 11/01/07, Marco Túlio Gontijo e Silva <[EMAIL PROTECTED]> wrote: is there a way to defined something as a map to use in tuples? I tried this: mapTuple f (a, b) = (f a, f b) But the type inferred to it is not as generic as I wanted: mapTuple :: (t -> t1) -> (t, t) -> (t1, t1) Let's think a

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread Arthur van Leeuwen
On 11-jan-2007, at 16:30, Marco Túlio Gontijo e Silva wrote: Em Qui, 2007-01-11 às 16:14 +0100, minh thu escreveu: you might want invistigate "heterogeneous lists" : in your case, it's "heterogeneous typle". But aren't tuples always heterogeneous? Yes, and precisely therein lies the proble

[Haskell-cafe] Re: Using PAPI to measure performance with CPU events

2007-01-11 Thread Alexey Rodriguez Yakushev
The URL might be useful to some :) http://hackage.haskell.org/trac/ghc/wiki/PAPI On Jan 11, 2007, at 17:10, Alexey Rodriguez Yakushev wrote: Dear all, I have added a page to the GHC commentary explaining how to use the PAPI library together with GHC to gather performance information from

[Haskell-cafe] Re: State monad strictness - how?

2007-01-11 Thread apfelmus
>> Unfortunately, the current situation is that State is only >> available as a lazy monad, and StateT is only available >> as a strict monad. > > I agree with you that both lazy and strict monads are important and > that we should have both options in a monad library. > > But the fun doesn't end

[Haskell-cafe] Using PAPI to measure performance with CPU events

2007-01-11 Thread Alexey Rodriguez Yakushev
Dear all, I have added a page to the GHC commentary explaining how to use the PAPI library together with GHC to gather performance information from your CPU (cache misses, branch misprediction). At present only cache miss information is supported in a platform independent way (though not

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread minh thu
2007/1/11, Marco Túlio Gontijo e Silva <[EMAIL PROTECTED]>: Em Qui, 2007-01-11 às 16:14 +0100, minh thu escreveu: > you might want invistigate "heterogeneous lists" : in your case, it's > "heterogeneous typle". But aren't tuples always heterogeneous? You're right but the fact you apply a funct

Re: [Haskell-cafe] UDP client/server

2007-01-11 Thread Gregory Wright
Hi John, On Jan 11, 2007, at 10:35 AM, Gregory Wright wrote: Hi John, On Jan 11, 2007, at 1:58 AM, John Ky wrote: Hello, Does anyone know where I can find a simple UDP client/server written in Haskell? Something along the lines of an echo server would do. Thanks -John Try:

Re: [Haskell-cafe] UDP client/server

2007-01-11 Thread Gregory Wright
Hi John, On Jan 11, 2007, at 1:58 AM, John Ky wrote: Hello, Does anyone know where I can find a simple UDP client/server written in Haskell? Something along the lines of an echo server would do. Thanks -John Try: -- -- UDPEchoServer.hs: Exactly what the name says, a datagram echo se

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread Marco Túlio Gontijo e Silva
Em Qui, 2007-01-11 às 16:14 +0100, minh thu escreveu: > you might want invistigate "heterogeneous lists" : in your case, it's > "heterogeneous typle". But aren't tuples always heterogeneous? Regards. -- malebria Marco Túlio Gontijo e Silva Correio (MSN): [EMAIL PROTECTED] Jabber (GTalk): [EMAIL

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread minh thu
2007/1/11, Marco Túlio Gontijo e Silva <[EMAIL PROTECTED]>: Hello, is there a way to defined something as a map to use in tuples? I tried this: mapTuple f (a, b) = (f a, f b) But the type inferred to it is not as generic as I wanted: mapTuple :: (t -> t1) -> (t, t) -> (t1, t1) Then I tried a

[Haskell-cafe] mapTuple

2007-01-11 Thread Marco Túlio Gontijo e Silva
Hello, is there a way to defined something as a map to use in tuples? I tried this: mapTuple f (a, b) = (f a, f b) But the type inferred to it is not as generic as I wanted: mapTuple :: (t -> t1) -> (t, t) -> (t1, t1) Then I tried a different, but not much, implementation: mapTuple' f g (a, b

Re: [Haskell-cafe] Can't figure out how to "show" for type "Int -> (Int, Int)"

2007-01-11 Thread Henning Thielemann
On Thu, 11 Jan 2007, Tom Titchener wrote: > Here' my code: > > data Term = Con Int | Div Term Term > type M a = State -> (a, State) -- higher-order type, e.g. function type > type State = Int -- type synonym > eval :: Term -> M Int > eval (Con a) x = (a, x) > eval (Div t u) x = let (a, y) = eval

Re: [Haskell-cafe] Can't figure out how to "show" for type "Int -> (Int, Int)"

2007-01-11 Thread Marco Túlio Gontijo e Silva
Em Qui, 2007-01-11 às 06:37 -0800, Tom Titchener escreveu: > ERROR - Cannot find "show" function for: > > *** Expression : eval answer > > *** Of type: Int -> (Int,Int) > type M a = State -> (a, State) -- higher-order type, e.g. function > type > > type State = Int -- type synonym So M a

[Haskell-cafe] Can't figure out how to "show" for type "Int -> (Int, Int)"

2007-01-11 Thread Tom Titchener
Typing up and running (via Hugs) the examples in Wadler's excellent "Monads for functional programming" (here: http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf) I hit the inevitable "show" function error: ERROR - Cannot find "show" function for: *** Expression : eval answe

Re: [Haskell-cafe] HaskellForge?

2007-01-11 Thread Seth Gordon
Yitzchak Gale wrote: > tphyahoo wrote: > >> I think people want something like CPAN. This implies a centralized >> "official" repository > > > I agree. > > I think we also need a notion of a canonical > standard package for each popular category. For some categories, it might be better to have

Re: [Haskell-cafe] HaskellForge?

2007-01-11 Thread Yitzchak Gale
tphyahoo wrote: I think people want something like CPAN. This implies a centralized "official" repository I agree. I think we also need a notion of a canonical standard package for each popular category. True, it is sometimes nice to have a lot of alternatives to choose from. And to be able t

Re: [Haskell-cafe] UDP client/server

2007-01-11 Thread Dan Mead
I think he meant something more along the lines of (or exactly) this, but in Haskell http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html I for one would also be interested in reading a tutorial like this using the ghc libs -Dan On 1/11/07, Henning Thielemann <[EMAIL PR

Re: [Haskell-cafe] State monad strictness - how?

2007-01-11 Thread Udo Stenzel
Ross Paterson wrote: > This (like StateT) gives you strictness in the pair, but doesn't give > the strictness in the state that the original poster wanted. I think the OP wanted both. If State is lazy in the pair, a long chain of the form (a >>= (b >>= (c >>= ... >>= z))) gets build up and blows

Re: [Haskell-cafe] State monad strictness - how?

2007-01-11 Thread Udo Stenzel
Yitzchak Gale wrote: > You're right, it is not in the docs. I don't think anyone would > have planned it that way. StateT is strict only because there > happens to be a line in a do-expression that looks like: > (a, s') <- runStateT m s > The tuple pattern-match causes the strictness.

Re: Re[2]: [Haskell-cafe] State monad strictness - how?

2007-01-11 Thread Yitzchak Gale
Josef Svenningsson wrote: Take the state monad for example. Should it be strict or lazy in the state that it carries around? What about the value component? ...both strict and lazy variants are useful. I wrote: Are those really needed? ...it wouldn't be very convenient, would it? Sometimes

Re: [Haskell-cafe] HaskellForge?

2007-01-11 Thread tphyahoo
I think people want something like CPAN. This implies a centralized "official" repository, somewhere that isn't going to go away, ever, because too many people would scream. It should probably be mirrored, too, like with cpan. Maybe darcs.haskell.org is ok for this roll already. Not sure. (Still

Re: [Haskell-cafe] State monad strictness - how?

2007-01-11 Thread Yitzchak Gale
Iavor Diatchki wrote: The state transformer inherits its behavior from the underlying monad. Ross Paterson wrote: This (like StateT) gives you strictness in the pair, but doesn't give the strictness in the state that the original poster wanted. I think it does - if you run his program with S

Re: [Haskell-cafe] UDP client/server

2007-01-11 Thread Henning Thielemann
On Thu, 11 Jan 2007, John Ky wrote: > Does anyone know where I can find a simple UDP client/server written in > Haskell? There is some support as part of a SuperCollider wrapper: http://www.slavepianos.org/rd/sw/sw-69/Sound/OpenSoundControl/UDP.hs ___