Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Arthur Baars
Chris, the subject states clearly that Aditya is a Newbie, and is most likely just trying to define the function map. So I think pointing to a bunch of advanced type magic tricks is not really helpful. Aditya, you say you want the function applyArgument to take a function and a list and apply

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Arthur Baars
this in Haskell. The short answer is no. You cannot do this in plain Haskell. However using various extensions to Haskell, you can indeed use the smart tricks as Chris pointed out: http://okmij.org/ftp/Haskell/types.html Cheers, Arthur On 19-mei-06, at 11:24, Arthur Baars wrote: Chris

Re: [Haskell-cafe] Small syntax question

2006-02-13 Thread Arthur Baars
The problem is that the semicolon after let a = 3 is consumed as part of the let-declaration. To make sure that the semicolon is not parsed as part of the let, you need to indent it less than the variable a. For example: module Main where main = do { let a = 3 ; return (); };

Re: [Haskell] Compiling wxHaskell from source?

2005-11-17 Thread Arthur Baars
Wouter Swierstra succeeded compiling wxhaskell for Mac OSX Tiger. See his messages on the wxhaskell-mailinglist: http://sourceforge.net/mailarchive/forum.php?forum_id=34197 From: Wouter Swierstra [EMAIL PROTECTED].Nott.AC.UK Re: Installation on Mac OS X   2005-11-09 04:42 Yep, that fixes it.

Re: type annotations for GADTs

2005-09-29 Thread Arthur Baars
I think it is a bug. It also works with silly type annotations: doy :: Y X a b - Y X a b doy (Y (X :: foo)(X :: bar)) = Y X X Looks like something smart is happening in the Pattern Annotation rule. Arthur On 29-sep-05, at 12:40, Ganesh Sittampalam wrote: Hi, I found it slightly surprising

Re: [Haskell-cafe] mistake in Gentle Introduction

2005-09-22 Thread Arthur Baars
the parser made by Arthur Baars, trading speed for better error messages? Maybe even the speed issue could be solved. Speed, error messages and recovery were not my main concern when writing the parser. I think a lot can be gained by optimizing the combinator-based parsers. However this is no fun. I

Re: [Haskell-cafe] wxHaskell: getting a checkbox state

2005-09-14 Thread Arthur Baars
Hi, A Checkbox is instance of the class Checkable: http://wxhaskell.sourceforge.net/doc/ Graphics.UI.WX.Classes.html#t%3ACheckable This means you can get and set the checked property for checkboxes. for example: c - get cbEdit checked set cbEdit [checked := not c ] The following code

GADT: weird error message

2005-09-12 Thread Arthur Baars
In the code below the function trans is accepted by GHC 6.4, but trans1 is not. I would expect that (x,y) is just syntactic sugar for (,) x y, but apparently it isn't. I guess this is a bug; can anyone explain what is going on? Cheers, Arthur The Code: data Equal a b where Eq :: Equal

GADT: weird error message

2005-09-06 Thread Arthur Baars
In the code below the function trans is accepted by GHC 6.4, but trans1 is not. I would expect that (x,y) is just syntactic sugar for (,) x y, but apparently it isn't. I guess this is a bug; can anyone explain what is going on? Cheers, Arthur The Code: data Equal a b where Eq :: Equal

Re: [Haskell] ANNOUNCE: ghc-src version 0.2.0

2005-08-30 Thread Arthur Baars
August 2005 13:04, Arthur Baars wrote: Daan is right, I wrote a parser for GHC using Doaitse Swierstra's parsing combinator library (http://www.cs.uu.nl/groups/ST/Software/UU_Parsing/index.html). Very interesting. I tried to download it but I had no success. How exactly do I checkout the whole uust

Re: [Haskell-cafe] Parse error

2005-03-17 Thread Arthur Baars
You need { } around the declaration of matrix1. Otherwise the semicolon at the end of its definition is considered to be part of the 'let': let { matrix1 = (array ((1,1),(3,3)) [((1,1), 0.0), ((1,2), 0.0), ((1,3),-2.0), ((2,1), 0.0), ((2,2), 7.0), ((2,3), 0.0), ((3,1), 0), ((3,2), 0),

Re: [Haskell-cafe] Parser problem continued

2005-03-15 Thread Arthur Baars
The layout of your code is very important when writing haskell code: Your code : expr = do t - term do symbol + e - expr return e return (t + e) +++ return t is equivalent to: expr = do { t - term ; do { symbol + ; e -

Re: [Haskell-cafe] Must be a FAQ - Can't make install Hugs98-Nov2003 on MacOSX 10.3.8

2005-02-25 Thread Arthur Baars
See the hugs-bugs archive: http://www.mail-archive.com/hugs-bugs@haskell.org/msg02815.html Malcolm Wallace wrote: The configure script is (wrongly) determining that the MacOS X C compiler does not support Floats/Doubles. Ideally, the autoconf magic which determined this setting should be fixed,

Re: [Haskell-cafe] Problem with type signature in local function

2004-12-24 Thread Arthur Baars
You could also do it with the current implementation of scoped type variables. So you don't need to compile the CVS HEAD version. Note that you need the pattern (n1::a) and/or (n2::a) to introduce the scoped type variable, which was not necessary in Ralf's solution. {-# OPTIONS -fglasgow-exts

Re: [Haskell-cafe] Re: generalised algebraic data types, existential types, and phantom types

2004-07-23 Thread Arthur Baars
describes what you are trying to achieve with your 'Term' data type. Arthur [1]Typing Dynamic Typing, Arthur Baars and Doaitse Swierstra. ICFP 2002. http://www.cs.uu.nl/~arthurb/dynamic.html [2]A lightweight implementation of generics and dynamics, James Cheney and Ralf Hinze. Haskell Workshop 2002

Re: [Haskell-cafe] What's wrong with my Haskell code?

2004-04-13 Thread Arthur Baars
It is because you use 'div' instead of '/'. div :: Integral a = a - a - a (/) :: Fractional a = a - a - a Rationals are instance of the class Fractional, but not of Integral Prelude :i Fractional class Num a = Fractional a where (/) :: a - a - a recip :: a - a fromRational :: Rational - a

Re: lexer puzzle

2003-09-15 Thread Arthur Baars
I agree with Marcin, A... should be split into A.. and . As I read the (on-line) report the maximal munch rule says that you should read the longest lexeme. It does not say that two operators have to be separated by whitespace. Because A... is not a lexeme, the longest lexeme you can read

Announce: wxhaskell: MacOSX installer

2003-07-24 Thread Arthur Baars
I have created an out-of-the-box MacOS X installer for wxHaskell. Simply double-click on the package. The installer can be downloaded from: http://home.deds.nl/~dediav/WxHaskell.dmg This link is only valid for a couple of weeks. After Daan returns from holidays he'll probably put it on the

GHC 6 for Mac OS X: fix for package util/readline

2003-07-21 Thread Arthur Baars
On Mac OS X GHCi 6.0 complains about a missing symbol when trying to load package util. Wolgang Thaller told me the cause of this bug: The problem was that there was a file called HsReadline.c. The corresponding object file, HsReadline.o, replaced HSreadline.o on the Mac's case-insensitive file

Re: clueless GHCI user wishes to load QuickCheck

2003-03-11 Thread Arthur Baars
QuickCheck is in de util package. You can load a package with the -package flag: $ ghci -package util Prelude :browse QuickCheck class Arbitrary a where { arbitrary :: Gen a; coarbitrary :: forall b. a - Gen b - Gen b; } arbitrary :: forall a. (Arbitrary a) = Gen a ... Prelude:module

Building snapshot ghc-5.05.20030123 on macOSX

2003-02-12 Thread Arthur Baars
I want to play a bit with Template Haskell, so I downloaded a cvs snapshot (ghc-5.05.20030123.tar.gz) and tried to compile it on my mac (OSX 10.2). I figured out that I needed a stage2 or stage3 compiler to get TH working, so I tried 'make stage3' . GHC started to compile itself three times. At

Re: question about parsing integers and floats with Parsec

2002-08-16 Thread Arthur Baars
Hi, Here is a solution that does not use try. import Parsec import qualified ParsecToken as P import ParsecLanguage (emptyDef) lexer = P.makeTokenParser emptyDef -- naturalOrFloat parses a float or an integer without sign naturalOrFloat = P.naturalOrFloat lexer

Existentials and newtype

2001-11-22 Thread Arthur Baars
At [EMAIL PROTECTED] I asked the following: this works data Exists f = forall x . E ( f x) this doesn't work newtype Exists f = forall x . E ( f x) Hugs accepts both. It there a reason why existential quantification does not work with a newtype, or is it just a

Exists for all places

2001-11-20 Thread Arthur Baars
I see the difference in behaviour of the parser for newtype and data definitions in combination with universal quantifications, as reported by Ralf Hinze (forall for all places, October 2001), has been fixed in GHC version 5.02.1. I encountered a similar problem with existential quantification: