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)
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
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
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
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
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:
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
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
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.
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?
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
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
12 matches
Mail list logo