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
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
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 ();
};
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.
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
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
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
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
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
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
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),
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 -
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,
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
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
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
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
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
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
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
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
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
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
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:
24 matches
Mail list logo