RE: SPECIALIZE pragma

2003-02-13 Thread Simon Peyton-Jones
If 'g' is defined in the same module, yes. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] | Sent: 12 February 2003 23:45 | To: [EMAIL PROTECTED] | Subject: SPECIALIZE pragma | | Hi, | | If I have {-# SPECIALIZE f ... #-}, | and I have f x y = ... (g x)

Re: ANNOUNCE: Learning Haskell portal, version 0.1

2003-02-13 Thread Jerzy Karczmarczuk
Arjan van IJzendoorn wrote: Often we see messages from people who want to learn Haskell (something we applaud), but don't know where to begin. ... Enough talk: http://www.cs.uu.nl/~afie/haskell/LearningHaskell.html Thanks, Arjan, nice work. I would add some significant papers, such as John

a monadic if or case?

2003-02-13 Thread David Roundy
Hello all. I was just thinking that there ought to be a better way to write the following code. It seems to be a common case that within a 'do' I bind a variable that I only intend to use once, in an if or case statement. It occurred to me that there ought to be a better way to do this. For

Re: a monadic if or case?

2003-02-13 Thread Arjan van IJzendoorn
whatisit :: String - IO String whatisit f = do ifM doesDirectoryExist f then return dir else ifM doesFileExist f then return file else return nothing Is there any way I could do something like this? Not with the syntactic sugar of 'if'. But you can

MArray and newSTUArray

2003-02-13 Thread Dean Herington
The MArray class in Data.Array.MArray is a very nice abstraction. However, when creating an array whose type partakes of MArray, say STUArray, I find myself defining and using a type-specific creation function, such as: newSTUArray :: (MArray (STUArray s) e (ST s), Ix i) = (i, i) - e

Re: a monadic if or case?

2003-02-13 Thread Keith Wansbrough
Not with the syntactic sugar of 'if'. But you can write [warning: untested code ahead] ifM :: IO Bool - IO a - IO a - IO a ifM test yes no = do b - test if b then yes else no There is a little trick that allows you to sort-of get the syntactic sugar. It goes like this [warning:

Re: a monadic if or case?

2003-02-13 Thread Dean Herington
Here's another way to sugar if-then-else that works like C's ?: and Lisp's cond: import Monad (liftM3) import Directory (doesFileExist, doesDirectoryExist) infix 1 ?, ?? (?) :: Bool - a - a - a (c ? t) e = if c then t else e (??) :: (Monad m) = m Bool - m a - m a - m a (??) = liftM3 (?) main

Bracketless branch if, sugar to taste...

2003-02-13 Thread Alex Ferguson
Yes indeed, one can further sugar Keith's suggestion to eliminate the need for brackets around the branches. Though as this means using an infix operator then and else, with corresponding mangling of the lexical appearance of same, this becomes increasingly a matter of taste (or perhaps, in need

ANNOUNCE: 0th International Obfuscated Haskell Code Contest

2003-02-13 Thread shae
In the spirit of http://ioccc.org/ Bring us your poor, weary, downtrodden, and unreadable source code. Come to the 0th INTERNATIONAL OBFUSCATED HASKELL CODE CONTEST! This contest is meant to be fun, short, and not terribly serious. Also, then we'll know if a 1st IOHCC is a good idea.

Re: a monadic if or case?

2003-02-13 Thread Andrew J Bromage
G'day all. On Thu, Feb 13, 2003 at 02:54:42PM -0500, David Roundy wrote: That's pretty nice (although not quite as nice as it would be to be able to use real ifs with no extra parentheses). Any idea how to do something like this with a case?

Learning Haskell moved

2003-02-13 Thread Arjan van IJzendoorn
Hello all, The Learning Haskell page has moved to a better place, the official Haskell homepage. You can now find it at http://www.haskell.org/learning.html and through a link on the Haskell homepage index. Jerzy wrote: I would add some significant papers, such as John Hughes' Why

Pattern matching, implict par. question

2003-02-13 Thread Jorge Adriano
Hello, When trying type CTPar = ([Double],Int,Int) ctPar ::(?ctPar::CTPar)=CTPar ctPar@(us,n,j) = ?ctPar I got this error message in ghci is: Illegal overloaded type signature(s) in a binding group for ctPar, us, n, j that falls under the monomorphism restriction