Re: Type class inference trouble

2001-02-16 Thread Ken Shan
On 2001-02-16T09:52:41+0100, Lars Lundgren wrote: > This is ad hoc overloading, and IMHO bad style, at least in haskell. As I > understand it, haskell type classes were never intended to support this. Well, whether this is ad hoc overloading depends on whether you find ad hoc this particular theo

Re: Type class inference trouble

2001-02-16 Thread Ken Shan
On 2001-02-16T07:56:42+, Marcin 'Qrczak' Kowalczyk wrote: > > > test2 = apply [int 3] (apply [(+)::Int->Int->Int] [int 5]) > The monomorphism restriction bites again. A variable binding without > a type signature is monomorphic... But, but, but... The type *is* monomorphic, in the sense t

Re: Lifting to the limit

2001-02-16 Thread Saswat Anand
Thanks a lot. It works fine. Could you help me with this. With the following defintions, I want to be able to write (high \+ 4) (3.4,2) and (4 \+ high) (3.4,2) which both should be equal to 4+ (high 2) = 6. But hugs gives following error during run time: ERROR: Unresolved overloading *** Type

Re: FixIO/ Tackling Awkward Squad

2001-02-16 Thread Levent Erkok
> Sorry, this one should be OK: > > fixIO m = let > x = unsafePerformIO (liftM Box (m (unbox x))) > in return . unbox $! x Unfortunately, that's not good either: Consider again: e :: IO Int e = do { x <- fixIO (\x -> do {putStr "hello"; return (x+1)}); return 2} If I run e several tim

[newbie] Lazy >>= ?!

2001-02-16 Thread andrew
There seems to be something funny going on here - I thought all the following were equivalent, but only listList1 works with > liftM (take 2) listListn Is there any way to write listList2 or 3 so that they are lazy (what I'm really trying to do is get the same kind of code to work on an IO Monad

Re: Lifting to the limit

2001-02-16 Thread Ken Shan
Tis the season for type class overloading fun... On 2001-02-16T21:45:32+0800, Saswat Anand wrote: > lift2 :: (a -> b -> c) -> Formula d a -> Formula e b -> Formula Env c This type is too general. You need to specify a context that requires both d and e to satisfy Lift: lift2 :: (Lift d, Li

Re: FixIO/ Tackling Awkward Squad

2001-02-16 Thread Marcin 'Qrczak' Kowalczyk
Fri, 16 Feb 2001 10:49:14 -0800, Levent Erkok <[EMAIL PROTECTED]> pisze: > > fixIO m = let > > x = unsafePerformIO (liftM Box (m (unbox x))) > > in return (unbox $! x) > > But that doesn't do the effects either.. Sorry, this one should be OK: fixIO m = let x = unsafePerformIO (lift

Re: FixIO/ Tackling Awkward Squad

2001-02-16 Thread Levent Erkok
Marcin 'Qrczak' Kowalczyk wrote: > > Fri, 16 Feb 2001 10:01:06 -0800, Levent Erkok <[EMAIL PROTECTED]> pisze: > > > The non-strict version is not good either, because it won't do > > the effects! > > data Box a = Box {unbox :: a} > > fixIO m = let > x = unsafePerformIO (liftM Box (m (unbox

Re: FixIO/ Tackling Awkward Squad

2001-02-16 Thread Marcin 'Qrczak' Kowalczyk
Fri, 16 Feb 2001 10:01:06 -0800, Levent Erkok <[EMAIL PROTECTED]> pisze: > The non-strict version is not good either, because it won't do > the effects! data Box a = Box {unbox :: a} fixIO m = let x = unsafePerformIO (liftM Box (m (unbox x))) in return (unbox $! x) -- __("< Marcin K

Re: FixIO/ Tackling Awkward Squad

2001-02-16 Thread Levent Erkok
I recently wrote: > So, it looks like: > > fixIO m = let x = unsafePerformIO (m x) in return x > > will do a better job. But of course, I forgot to make my point before sending the message! The non-strict version is not good either, because it won't do the effects! Consider the definition:

Re: FixIO/ Tackling Awkward Squad

2001-02-16 Thread Levent Erkok
Marcin 'Qrczak' Kowalczyk wrote: > > Fri, 16 Feb 2001 04:14:26 -0800, Simon Peyton-Jones <[EMAIL PROTECTED]> pisze: > > > fixIO m = do { v <- newEmptyMVar > >; result <- m (unsafePerformIO (takeMVar v)) > >; putMVar v result > >; return result } >

Re: FixIO/ Tackling Awkward Squad

2001-02-16 Thread Marcin 'Qrczak' Kowalczyk
Fri, 16 Feb 2001 04:14:26 -0800, Simon Peyton-Jones <[EMAIL PROTECTED]> pisze: > fixIO m = do { v <- newEmptyMVar >; result <- m (unsafePerformIO (takeMVar v)) >; putMVar v result >; return result } If we have unsafePerformIO, why not this? fixIO

ANNOUNCE: nhc98-1.02 RPMS for RedHat Linux 7.0

2001-02-16 Thread José Romildo Malaquias
Hello. I have built RPM packages for hmake-1.02 and nhc98-1.02 for RedHat Linux 7.0, available from ftp://urano.iceb.ufop.br/pub/nhc98/ Romildo. === On Wed, Feb 14, 2001 at 01:27:48PM +, [EMAIL PROTECTED] wrote: > We are p

Re: Haskell threads & pipes & UNIX processes

2001-02-16 Thread Marcin 'Qrczak' Kowalczyk
Fri, 16 Feb 2001 12:16:51 +0100 (CET), Michael Marte <[EMAIL PROTECTED]> pisze: > Indeed, the file produced by the Haskell program is one byte longer > than the file produced by bzip (called from the command line). Sorry, it works for me (bzip2-1.0.1, ghc fresh from CVS). -- __("< Marcin Ko

RE: FixIO/ Tackling Awkward Squad

2001-02-16 Thread Ronald Legere
--- Simon Peyton-Jones <[EMAIL PROTECTED]> wrote: > fixIO m = do { v <- newEmptyMVar >; result <- m (unsafePerformIO (takeMVar v)) >; putMVar v result >; return result } > > Of course, this just begs the question of what > exactly > unsafePerfo

RE: FixIO/ Tackling Awkward Squad

2001-02-16 Thread Simon Peyton-Jones
| Dear Haskellers, | After enjoying "Tackling the Awkward Squad" (Simon | Peyton Jones), I wonder what other elements of the | squad can be tackled in a simular way? Right now I am | thinking about FixIO. This little bugger seems to show | up in a lot of code! Can we give it an operational |

Postdoctoral Position

2001-02-16 Thread Elke Tetzner
Please pass on to interested Post doctorants. Apologies for multiple copies. New Postdoctoral Position (DEADLINE 1 April 2001) Department of Computer Science, University of Ros

Lifting to the limit

2001-02-16 Thread Saswat Anand
Dear All, I have this following simplified problem. Please help. type Formula a b = a -> b type Env = (Integer,Char) fun :: Formula Integer Integer fun n = n+1 sun :: Formula Char Integer sun c = toInteger.ord c I want to be able to write (sun + fun) (2,'a') (fun + sun) (2,'a') bot

Re: Haskell threads & pipes & UNIX processes

2001-02-16 Thread Michael Marte
Hello Marcin, > Thu, 15 Feb 2001 08:50:41 -0800, Julian Seward (Intl Vendor) ><[EMAIL PROTECTED]> pisze: > > > use the foreign import mechanism to make BZ2_bzopen, > > BZ2_bzwrite and BZ2_bzclose available in your program. > > bzlib and zlib wrappers are available in >