On Tue, Feb 21, 2006 at 11:04:40PM +, Simon Marlow wrote:
> Your drop__ reminds me of GHC's touch#, which is like drop__ in the IO
> monad. We use it to control lifetimes, eg. inside withForeignPtr. You
> could implement drop in terms of touch#:
>
>drop__ a b = case touch# a realworld#
John Meacham wrote:
On Tue, Feb 21, 2006 at 10:15:59AM +, Malcolm Wallace wrote:
John Meacham <[EMAIL PROTECTED]> wrote:
I generalized this primitive to
drop__ :: a -> b -> b
Also known in the Prelude as "const"...
well, 'flip const' but yes.
The difference is that you propose
On Tue, Feb 21, 2006 at 10:15:59AM +, Malcolm Wallace wrote:
> John Meacham <[EMAIL PROTECTED]> wrote:
>
> > I generalized this primitive to
> >
> > drop__ :: a -> b -> b
>
> Also known in the Prelude as "const"...
well, 'flip const' but yes.
> The difference is that you propose it be pri
John Meacham <[EMAIL PROTECTED]> wrote:
> I generalized this primitive to
>
> drop__ :: a -> b -> b
Also known in the Prelude as "const"...
The difference is that you propose it be primitive, with the intention
that a clever compiler should not be able to bypass it by inlining its
definition a
After reading all the interesting responses I decided to go with a
slight generalization of my original idea, and it surprisingly turns out
to have other generally useful unintended uses, which is the point that a 'hack'
becomes a 'feature'. :)
before I had a primitive:
newWorld__ :: a -> World__
John Meacham wrote:
So, I finally decided that jhc needs real arrays, but am running into an
issue and was wondering how other compilers solve it, or if there is a
general accepted way to do so.
here is what I have so far
-- The opaque internal array type
data Array__ a
-- the array transform
Data.Array.ST has
runSTArray :: Ix i => (forall s . ST s (STArray s i e)) -> Array i e
I think if you can implement that, then all your problems will be solved.
-- Ben
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/list
I think you'll maximise your chances by sending mail about GUM and
Glasgow Parallel Haskell to the GpH mailing list
http://www.macs.hw.ac.uk/~dsg/gph/
Simon
| -Original Message-
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Yang, Qing
| Sent: 12 November 2003 0
On Thu, 23 Oct 2003 12:20 pm, Pratik Bhadra wrote:
>
> data Expr = Lit1 Int | Lit2 Bool | Var String | BinOp Op Expr Expr
>
> My evaluate code is as follows...
>
> evaluate :: Expr -> Store -> Expr
>
> evaluate ( Lit1 n ) st = n
> evaluate ( Lit2 n ) st = n
A function must match its type signature
Thanks, Artie and thanks to Dr Richards! I figured it out. I was not
correlating the Exprs properly. Now that I broke it up into Lit1 and Lit2 and am
returning a Lit1 or a Lit2
which will return an Expr, it works! :)
Pratik
Pratik Bhadra
Undergraduate Section Lea
At 9:20 PM -0500 10/22/03, Pratik Bhadra wrote:
Hi
I have a data type Expr for handling Expressions
data Expr = Lit1 Int | Lit2 Bool | Var String | BinOp Op Expr Expr
As you can see, I am trying to have an Expression have both Int and Bool
values so that I can work with both arithmetic (+,-,*,/)
Pratik Bhadra wrote:
Hi
I have a data type Expr for handling Expressions
data Expr = Lit1 Int | Lit2 Bool | Var String | BinOp Op Expr Expr
As you can see, I am trying to have an Expression have both Int and Bool
values so that I can work with both arithmetic (+,-,*,/) and
logical(and,or,<,<=,>,
On Mon, 15 Sep 2003, Yu Di wrote:
> data MyArrow a b = MyArrow ((String, a) -> (String,
> b))
>
> i.e. there is an "information" asscioated with each
> piece of data (represented by the string), and I want
> to pass it around. And often the arrow's processing
> logic will depend on the input inf
At 22:00 16/03/2003 -0800, Hal Daume III wrote:
It is not. Lets are expressions. Wheres are part of declarations. In a
grammar sense, you have something like:
funcdef ::= name = expr (where decls)?
expr::= let decls in expr
so the declarations inside a let are internal to the expression and
Hi,
> f x = let ...
>in
> ...
> where
> ...
>
> Assuming that all the ...s are legal, is this OK? Should it be? It
> really makes the 'where' clause look like it's inside the 'let', when
> in fact it can't be.
Ah, sorry. Yes, this is legal. However, if
[Hal Daume III <[EMAIL PROTECTED]>]
> No, that's not legal. You'll get an unbound variable error on the use of
> 'a' in the definition of 'b'. This doesn't really have anything to do
> with layout. Consider the following definition:
>
> > f x =
> >case x of
> > Nothing -> ...
> >
No, that's not legal. You'll get an unbound variable error on the use of
'a' in the definition of 'b'. This doesn't really have anything to do
with layout. Consider the following definition:
> f x =
>case x of
> Nothing -> ...
> Just (y,z) -> let Just q = z
>in
[Hal Daume III <[EMAIL PROTECTED]>]
> It is not. Lets are expressions. Wheres are part of declarations. In a
> grammar sense, you have something like:
>
> funcdef ::= name = expr (where decls)?
> expr::= let decls in expr
>
> so the declarations inside a let are internal to the expression
It is not. Lets are expressions. Wheres are part of declarations. In a
grammar sense, you have something like:
funcdef ::= name = expr (where decls)?
expr::= let decls in expr
so the declarations inside a let are internal to the expression and can't
go outside into the where clause.
--
H
On Wed, 26 Feb 2003 00:54:13 +
"Cesar Augusto Acosta Minoli" <[EMAIL PROTECTED]> wrote:
>
> ¿There's a way to input/output data from the computers' port in
> Haskell? ¿What about LPT1 or Com?
I guess the fastest way is to create a C library and use the FFI. If you
are on linux, you can
System.Time.getClockTime, IIRC. A quick browse through the libraries
confirms this.
--
Hal Daume III
"Computer science is no more about computers| [EMAIL PROTECTED]
than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume
On Wed, 22 Jan 2003, Cesar Augusto Acosta Minoli wrote
G'day all.
On Thu, Jan 02, 2003 at 08:39:18AM +, Alastair Reid wrote:
> Please note that this is NOT TRUE!
Whoops, you're right. Sorry, my mistake.
Cheers,
Andrew Bromage
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/l
> 1. Haskell 98 does not explicitly mandate tail recursion optimisation.
However, in practice Haskell compilers must provide this since it is
impossible to write a loop without using recursion and if your loops
don't use constant stack space, you're not going to run for very long.
> (In particul
G'day all.
On Wed, 1 Jan 2003, Andrew J Bromage wrote:
> > It has quite different performance characteristics, though. In
> > particular, this uses O(n) stack space whereas the accumulator one
> > uses O(1) stack space.
On Wed, Jan 01, 2003 at 12:17:10PM +0200, Shlomi Fish wrote:
> This is ass
On Wed, 1 Jan 2003, Andrew J Bromage wrote:
> G'day all.
>
> On Mon, Dec 30, 2002 at 01:47:37PM -0600, Artie Gold wrote:
>
> > One suggestion, though is that you're working too hard; there's really
> > no reason to define a locally defined function. The much simpler:
> >
> > long [] = 0
> > long (
G'day all.
On Mon, Dec 30, 2002 at 01:47:37PM -0600, Artie Gold wrote:
> One suggestion, though is that you're working too hard; there's really
> no reason to define a locally defined function. The much simpler:
>
> long [] = 0
> long (x:xs) = 1 + long xs
>
> will do quite nicely.
It has quit
> long = sum . map (const 1)
How's this?
/JongKeun
-Original Message-
From: William Lee Irwin III [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 31, 2002 5:18 AM
To: Artie Gold
Cc: Cesar Augusto Acosta Minoli; [EMAIL PROTECTED]
Subject: Re: Question About lists
On Mon, Dec
On Mon, Dec 30, 2002 at 01:47:37PM -0600, Artie Gold wrote:
> One suggestion, though is that you're working too hard; there's really
> no reason to define a locally defined function. The much simpler:
> long [] = 0
> long (x:xs) = 1 + long xs
> will do quite nicely.
> HTH,
> --ag
There is already
Cesar Augusto Acosta Minoli wrote:
Hello! I'm Working with Lists in Haskell, I´m a Beginner in Functional
Programming and I would like to know if there is a way to write a more
efficient function that return the length of a list, I wrote this one:
long:: [a]->Int
long p = longitu
On Mon, 30 Dec 2002, Cesar Augusto Acosta Minoli wrote:
> Hello! I'm Working with Lists in Haskell, I´m a Beginner in Functional
> Programming and I would like to know if there is a way to write a more
> efficient function that return the length of a list, I wrote this one:
>
> long :: [a]
Hi Cesar
If you check the prelude, you will find the definition (something like):
length::[a]->Int
length= foldl' (\n _ -> n + 1) 0
and the definition of foldl'
foldl' :: (a -> b -> a) -> a -> [b] -> a
foldl' f a [] = a
foldl' f a (x:xs) = (foldl' f $! f a x) xs
Which
Cesar Augusto Acosta Minoli wrote:
> Hello! I just Wanna Know, What should I do, to build a List of
> random Numbers, without IO type, just Float or Int
Use randoms or randomRs in conjunction with either mkStdGen or your
own instance of RandomGen, all from the Random module.
You only get an IO
Hello,
Hello! I just Wanna Know, What should I do, to build a List of random
Numbers,
without IO type, just Float or Int
the answer for this is either "you can't, read something about IO and monads
(good starting places are http://haskell.org/wiki/wiki?UsingIo and
http://haskell.org/wiki/wiki?U
> > For example:
> >
> > foo x = show x
> > versus
> > foo = \x -> show x
>
> And, why not the simplest version: "foo = show"...
>
> If we call these three versions "foo1", "foo2" and "foo3", then they are
> semantically equivalent because, besides having the same type, one can
> substit
Bernard James wrote:
> In section 4.4.3 "Function and Pattern Bindings" of the Haskell 98
Report,
> it gives the following translation:
[ the pattern lambda construction to case expression conversion from the
Report]
> What does it mean by "semantically equivalent". A rough approximation
is
> "h
Dean,
Alastair Reid wrote:
> > Just to be sure we agree on terminology: some people like to
> > distinguish between "parallelism" and "concurrency".
> >
> > Parallelism is a way of going faster but doesn't change your
> > programming model. Implemented correctly, a parallel implementation
> >
Dean,
> > If the costs are the same, does that rely on there being no true
> > concurrency in
> > the current implementations?
>
> It depends what you mean by true concurrency: from the point of view of
> the Haskell programmer, GHC's implementation of concurrency is "almost"
> preemptive, beca
Dean
| From Simon Marlow's reply, I gather that the current
| implementations of Concurrent Haskell provide "concurrency"
| but not "parallelism", and that provision of parallelism is
| not likely in the near term.
That's more or less right. The trouble is that for shared-memory
parallelism
Dean Herington <[EMAIL PROTECTED]> writes:
> From Simon Marlow's reply, I gather that the current implementations of
> Concurrent Haskell provide "concurrency" but not "parallelism", and that
> provision of parallelism is not likely in the near term.
Uh, GPH exists, doesn't it? So you can get "
By "true concurrency" I meant "simultaneous execution of multiple threads
by multiple processors". This involves both concepts you define:
"concurrency" (to have multiple threads) and "parallelism" (to have them
execute possibly simultaneously when multiple processors are available).
>From Sim
> I'm curious about the implementation of Concurrent Haskell in GHC
> and Hugs.
Hugs' implementation of concurrency is non-preemptive wherease GHC's
implementation is preemptive (or "almost preemptive") as described by
Simon.
> Does access to values possibly shared among threads cost the same i
> I'm curious about the implementation of Concurrent Haskell in GHC and
> Hugs. Does access to values possibly shared among threads
> cost the same
> in Concurrent Haskell as in regular Haskell? I'm guessing
> the answer is
> "yes", because Concurrent Haskell is provided by default in
> GHC.
At 2002-01-18 13:19, Hal Daume III wrote:
>In theory, I could write:
>
>class Traversable d a where
>traverse :: d a -> (Maybe a, [d a])
>
>instance Traversable Tree a where
>traverse (Leaf a) = (Just a, [])
>traverse (Branch t1 t2) = (Nothing, [t1,t2])
>
>instance Traversab
At 2002-01-18 13:10, Hal Daume III wrote:
>Now, I want to say that if some data type 'd' is Traversable and another
>data type 'e' is Traversable, then the "combined data type" is
>Traversable. That is, for example, I want to say that a Tree of Lists is
>traversable, or that a List of Trees, or
Oops, nevermind; that was dumb of me. I spoke too quickly. Of course
that would produce overlapping instances :)
--
Hal Daume III
"Computer science is no more about computers| [EMAIL PROTECTED]
than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume
On Fri, 18 Jan 2002, Ha
In theory, I could write:
class Traversable d a where
traverse :: d a -> (Maybe a, [d a])
instance Traversable Tree a where
traverse (Leaf a) = (Just a, [])
traverse (Branch t1 t2) = (Nothing, [t1,t2])
instance Traversable [] a where
traverse [] = (Nothing, [])
tr
At 2001-05-08 03:07, Markus Lauer wrote:
>Hugs sais ERROR Test.hs:20 - syntax error in instance head (constructor
> expected)
Invoke as 'hugs -98' to switch on extensions. Hugs will then complain of
overlapping instances:
instance FooList Char
instance Foo a => FooList a
Yes, I kno
In the good old days, you could use Hugs as a IE scripting engine, but that
is not supported anymore.
- Original Message -
From: "Michae Fliegner" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 04, 2001 3:51 PM
Subject: Question: Hugs as Browser Plug In
> I have - or at l
Lennart:
> There is no problem, [the meaning of numeric literals is] clearly specified by the
>report.
> (There is a problem with Hugs, it doesn't implement literals properly.
> Or has that ancient bug been fixed?)
Lennart is absolutely right, the report is quite unambiguous and there is
(still
"S.D.Mechveliani" wrote:
> Can we solve and close the problem of the meaning of decimal pointed
> leterals?
There is no problem, it's clearly specified by the report.
(There is a problem with Hugs, it doesn't implement literals properly.
Or has that ancient bug been fixed?)
> > "The floating p
is this not the dictionary passing (or whatever)to achieve overloading.
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 13 April 2001 06:48
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Question about hugs´s DEBUG_SHOWSC
>
> I need a class tree for haskell. where can i find it?
I'm interpreting this as you want a picture showing how the standard Haskell
classes relate to each other.
And my answer is to scroll 1/4 - 1/3 of the way down this page looking for a big
picture.
http://haskell.org/onlinereport/basic
Cris Okasaki [http://www.cs.columbia.edu/~cdo] has written tons of
papers on functional data structures, I guess you can steal code from
there. There was also a file containing all the examples from his
book `Purely Functional Data Structures' (Cambridge University Press,
1998, and everybody s
> I'm very glad to know if there exists
> somebody who will aid me or play together with me over
> 64-bit ghc for 64-bit HPUXes. Should I attack the
> problem from HBC or nhc98?
> The last kisstion: Can I build ghc from Hugs
Ghc can only be built by itself, not with any other Haskell system.
The
> Message: 1
> From: "ADAMS,RICHARD (Non-HP-Roseville,ex1)"
> <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: Question concerning ftp and GHC binaries
> for HP-UX
> Date: Wed, 21 Mar 2001 12:24:15 -0700
>
> I would like to download the GHC binaries to our HP
> 900
john xxx wrote:
>
> i want to know if HAskell has an inbuilt function in the prelude a function
> that allows me to use wild character like so:
>
> ie. if a list of strings contains a word or a combination of words that do
> not necessarily have to be side by side. someting that works like so [.
Simon thanks I'm afraid I didn't see your earlier reply.
I didn't try this in GHC, thanks for the clarification.
Hugs on the other hand does give a type:
g :: (Foo a b, Foo [b] [[[a]]]) => b -> [[[a]]] ->
Int
My assumption is that this is because of a dept
I replied last week:
-Original Message-
From: Simon Peyton-Jones
Sent: 28 February 2001 16:51
To: 'Dominic Duggan'; [EMAIL PROTECTED]
Subject: RE: please confirm that this is a feature
GHC infers the type
g :: (Foo [[a]] [b], Foo [[b]] [a]) => [a] -> [b] -> Int
As you imply, if GHC
em that Don highlighted.
With Hugs I got the following:
Main> main
(232 reductions, 458 cells)
which was puzzling. I'm running Version: May 1999 with -98.
Dominic.
[EMAIL PROTECTED] on 28/01/2001 11:18:00
To: don_wakefield
haskell
cc:
bcc:Dominic Steinitz
Subject:
Don
Crumbs! You're right!
The MVars that are drawn as heavy black boxes in Figure 7 of Tackling
the Awkward Squad are used to block the consumer when it catches up
with the producer. But if there is more than one consumer, it's not
OK to leave these MVars empty. Instead, getChan should do a
Marcin 'Qrczak' Kowalczyk wrote:
> Wed, 2 Aug 2000 17:01:09 +0200 (CEST), Wojciech Moczydlowski, Jr
><[EMAIL PROTECTED]> pisze:
>
> > The follow piece of code is accepted by hugs and ghc, rejected by
> > nhc and (I haven't seen it) by hbc. Is this code correct or not?
> >
> > type A = Either Int
Wed, 2 Aug 2000 17:01:09 +0200 (CEST), Wojciech Moczydlowski, Jr
<[EMAIL PROTECTED]> pisze:
> The follow piece of code is accepted by hugs and ghc, rejected by
> nhc and (I haven't seen it) by hbc. Is this code correct or not?
>
> type A = Either Int
>
> f:: (a -> b) -> A a -> A b
> f _ _ = Le
> > "Ronald" == Ronald J Legere <[EMAIL PROTECTED]> writes:
>
> > I am wondering however if there is anykind of small package
> > to enable me to make simple plots (of functions for example)..
> > This is for windows (98) machine, so I cant use Gif Writer, which
> > seems sort
Marko Schuetz writes:
> > "Mark" == Mark P Jones <[EMAIL PROTECTED]> writes:
>
> Mark> One of the greatest disappointments to date of the move
> Mark> to more liberal (i.e. free software) licenses for systems
> Mark> like Hugs and GHC, is that it has done almost nothing to
> Mark> stimu
Simon Marlow <[EMAIL PROTECTED]> wrote,
> > Out of curiosity, how big is the user community? How many
> > downloads of
> > the software? How many are on this list?
>
> There are ~700 people on the Haskell list, ~200 on glasgow-haskell-users and
> ~150 on hugs-users. About 160 people download
> Out of curiosity, how big is the user community? How many
> downloads of
> the software? How many are on this list?
There are ~700 people on the Haskell list, ~200 on glasgow-haskell-users and
~150 on hugs-users. About 160 people downloaded ghc-4.02 for Linux last
month, I'm waiting to find
On Mon, Aug 23, 1999 at 11:12:15AM +0200, Marko Schuetz wrote:
> In some countries "If it isn't explicitly allowed it's forbidden"
In most countries, you mean. This includes every country whose copyright
laws are based on the Berne convention. I know the USA and Finland
are like this, and I bel
> "Will" == Will Partain <[EMAIL PROTECTED]> writes:
Will> Marko Schuetz <[EMAIL PROTECTED]> writes:
>> ... It has taken the Haskell community quite some time to
>> switch to liberal licenses. IIRC only Hugs used to come
>> with a license at all, neither hbc, ghc nor nhc used to
>> have one f
Marko Schuetz <[EMAIL PROTECTED]> writes:
> ... It has taken the Haskell community quite some time to
> switch to liberal licenses. IIRC only Hugs used to come
> with a license at all, neither hbc, ghc nor nhc used to
> have one for quite some time.
GHC has always had a "liberal license", it jus
I don't think the development tools are the real problem;
it's the size of the pile of readily-available Haskell
modules (and {libraries,sets} of modules) that do useful
things.
Nowadays, when setting out to tackle a programming problem
(in any language), you kinda hope that big chunks of the
cod
> Have you ever thought about the official definition
> of Haskell in the introduction to Haskell Report,
> or in its presentation in FAQ of comp.lang.functional?
> It sounds like mumbo-jumbo, because all the terms
> used there are foreign to Joe Programmer. That doe
On 20 Aug 1999, Will Partain wrote:
> The great thing about "the modules problem" is that nearly
> anyone can contribute -- you don't have to know the innards
> of any Haskell implementation in order to be useful.
Right now, there is, in fact not a lot of installed base of Haskell code.
Accumulat
Mark Jones wrote:
> One of the greatest disappointments to date of the move
> to more liberal (i.e. free software) licenses for systems
> like Hugs and GHC, is that it has done almost nothing to
> stimulate contributions to the implementations themselves
> from outside the immediate (and small) g
> "Mark" == Mark P Jones <[EMAIL PROTECTED]> writes:
Mark> One of the greatest disappointments to date of the move
Mark> to more liberal (i.e. free software) licenses for systems
Mark> like Hugs and GHC, is that it has done almost nothing to
Mark> stimulate contributions to the implementation
On Fri, 20 Aug 1999, Claus Reinke wrote:
> There is a Free On-Line Dictionary Of Computing (FOLDOC) at
>
> http://foldoc.doc.ic.ac.uk/foldoc/index.html
>
> You might consider updating the entries there if you suceed.
As a matter of fact, I am using that and few other sources
On 19 Aug, Mark P Jones wrote:
> [...] note that the error messages that prompted
> Jon's comment didn't have anything to do with sophisticated type systems.
> Dealing with those kinds of things requires some hard work, but it isn't
> research, and so it's hard to justify, at least in an acade
"D. Tweed" wrote:
> The other question to consider is the `sociological makeup' of the user
> base. Looking at most people who hack on Free Software projects they are
> either people doing undergrad computer science degrees or who work in
> computers after finishing/dropping out part way through c
Warning: comments based on mailing list/internet obesrvations which may
be more representative of what people say than what they do.
On Thu, 19 Aug 1999, Mark P Jones wrote:
> Hi Alex,
>
> | Out of curiosity, how big is the user community? How many downloads of
> | the software? How many are
Fri, 20 Aug 1999 02:59:09 +1000, Bob Howard <[EMAIL PROTECTED]> pisze:
> data BTree Integer = Leaf Integer | Node Integer (BTree Integer) (BTree Integer)
Write either
data BTree a = Leaf a | Node a (BTree a) (BTree a)
or
data BTree = Leaf Integer | Node Integer BTree BTree
depending on what
On 20 Aug, Bob Howard wrote:
> data BTree Integer = Leaf Integer | Node Integer (BTree Integer) (BTree Integer)
^
this ought to be a type variable name, but you've put the
name of a type.
> mkTree :: Integer -> BTree
^ arg
On Thu, 19 Aug 1999, S. Alexander Jacobson wrote:
> Mark,
>
> Out of curiosity, how big is the user community? How many downloads of
> the software? How many are on this list? If you figure that 1 user in
> 1000 is actually going to contribute a useful change each month (that is
> probably
Mark,
Out of curiosity, how big is the user community? How many downloads of
the software? How many are on this list? If you figure that 1 user in
1000 is actually going to contribute a useful change each month (that is
probably optimistic), the slow flow of changes isn't that surprising.
A
Hi Alex,
| Out of curiosity, how big is the user community? How many downloads of
| the software? How many are on this list?
I don't know the answers to any of these, but I think you're implying
"very small", and I'm sure you're right. Perhaps you're also suggesting
that our community is too
> Ok my last post was a bit of a silly question on my behalf, but this
> has be stumped.
>
> data BTree Integer
> = Leaf Integer | Node Integer (BTree Integer) (BTree Integer)
> mkTree :: Integer -> BTree
> mkTree 0 = Leaf 0
> mkTree int = Node int (mkTree (int - 1)) (mkTree (int -1))
>
>
> Bob Howard wrote:
>
> Ok my last post was a bit of a silly question on my behalf, but this
> has be stumped.
>
> data BTree Integer = Leaf Integer | Node Integer (BTree Integer)
> (BTree Integer)
> mkTree :: Integer -> BTree
> mkTree 0 = Leaf 0
> mkTree int = Node int (mkTree (int - 1)) (mkTre
| Actually, I have fond memories of Algol compilers that gave error
| messages pretty much as comprehensible as those above. I guess the
| problem is that Haskell compilers are prepared by people who have more
| pressing tasks than repeating old work on user friendly error messages
| :-(
Jon's c
| Ok my last post was a bit of a silly question on my behalf, but this
| has be stumped.
|
| data BTree Integer = Leaf Integer | Node Integer (BTree Integer) (BTree Integer)
| ...
| can anyone tell me why I get this error when I compile this.
| ERROR "Btree.hs" (line 2): Illegal left hand side i
> so I want to create a proper set of linear algebra tools to
> write a ray-tracer
> in haskell, this includes a few types, a Point and a Vector
> both of which can be
> represented by 3 Floats, I would like the following operations..
> Vector+Vector = Vector
> Point + Vector = Point
> Point + P
You might look at the geometry library in Fran (you can find a link in
haskell.org to Fran if you need it). It implements points and vectors
similar to what you're looking for. To answer your questions, you
can't (in standard Haskell) use the conventional operator names for
all of the operations
> I have written this small simple program
>
> module Add where
> add :: Int -> Int -> Int
> addx1 x2 x1 + x2
>
> I have create an object file with the command % ghc -c additon.hs
> Now I will create an executable file.
> What I have to do?
Well, where is your Main module? Haskell
> f (x then k) = x then (f . k)(*)
> = x then (\y -> f (k y))
>
> where, of course, f is an adequate polymorphic function i.e.
> f : M a -> M a for any type $a$.
You really want here f : M a -> M b.
> It is easy to se
S.M.Kahrs wrote:
>
> > f (x then k) = x then (f . k)(*)
> > = x then (\y -> f (k y))
> >
[...]
> > In the case of the list monad (M a = [a]), equation (*)
> > holds only if $f$ is a morphism over the concat operator
> > i.e. f (u ++ v) = (f u) ++
> > class Many m where
> > components :: m a -> [a]
>
> > instance (Many m, Show a) => Show (m a) where
> >showsPrec _ ma = shows (components ma)
>
> I know that an instance declaration requires a type constructor
> (and m is a type constructor variable), but I don't understand why.
> The
> Prompted by an IOHCC entry I have the following question:
>
> Is the following legal?
>
> --
> module M(x) where
> x = 1
> z = x==1
> --
>
> If the definition of z wasn't there it would clearly be
> illegal since it exports an overload non-function val
94 matches
Mail list logo