Patrick LeBoutillier patrick.leboutillier at gmail.com writes:
[...]
exprt = Ap (Const mapt) (Const idt)
test = runTI $ tiExpr initialEnv [] exprt
When I execute the test function above in ghci I get:
([],TVar (Tyvar v3 Star)).
I was expecting someting like below for the type
Louis Wasserman wasserman.louis at gmail.com writes:
While working on the Shootout, I noticed the following benchmarks:
http://shootout.alioth.debian.org/u64/program.php?test=chameneosreduxlang=ghcid=3
http://shootout.alioth.debian.org/u64q/program.php?test=chameneosreduxlang=ghcid=3
[...]
Daniel Peebles pumpkingod at gmail.com writes:
My solution attempted to exploit this using Numeric.showIntAtBase but
failed because of the lack of 0 prefixes in the numbers. If you can
find a simple way to fix it without duplicating the showIntAtBase
code, I'd be interested!
Another
Günther Schmidt gue.schmidt at web.de writes:
Hi guys,
I'd like to generate an infinite list, like
[a, b, c .. z, aa, ab, ac .. az, ba, bb, bc ..
bz, ca ...]
If you're happy to have a before the a, you can do this as a fairly cute
one-liner in a similar style to this list of
Andrew Wagner wagner.andrew at gmail.com writes:
I'm sure there's a way to do this, but it's escaping me at present. I
want to do something like this:
data Foo = Bar a = Foo a Bool ...
That is, I want to create a new type, Foo, whose constructor takes
both a Boolean and a value of
John Lask wrote:
:
| The following code causes a C stack overflow in hugs (version 20051031)
| but not in ghc (version 6.6)
| The point of the exercise is to process a very large file lazily,
| returning the consumed and unconsumed parts (i.e. basic parser
combinators).
:
| sqnc p
Norman Ramsey wrote:
:
| This code fails to compile because the compiler is willing to
| use 'fold' at only one type (CmmExpr as it happens)
:
When it failed to compile, was
fold = foldRegsUsed
a top-level declaration in the module, rather than local to foldRegsUsed?
If so, try
Quoting Stefan O'Rear [EMAIL PROTECTED]:
On Mon, Sep 17, 2007 at 04:15:10PM +1200, Tom Pledger wrote:
Norman Ramsey wrote:
:
| This code fails to compile because the compiler is willing to
| use 'fold' at only one type (CmmExpr as it happens)
:
When it failed to compile, was
fold
Arie Groeneveld wrote:
:
| Looking at the result of my rewriting gives me the idea it isn't
| Haskelly enough.
|
| Anyways, here's my interpretation:
|
| -- period m/n base = (period length, preperiod digits, period digits)
| period :: Integer - Integer - Integer - (Int, ([Integer],
We've seen some nice concise solutions that can deal with the original
problem:
solve 1505 [215, 275, 335, 355, 420, 580]
I'll be a nuisance and bring up this case:
solve 150005 [2, 4, 150001]
A more scalable solution is to use an explicit heap that brings
together all the ways to
*Andrew Coppin wrote:
*
| I'm trying to construct a function
|
| all_trees :: [Int] - [Tree]
|
| such that all_trees [1,2,3] will yield
:
If you write a helper function that takes an N element list, and returns
all 2^N ways of dividing those elements into 2 lists, e.g.
splits ab --
Stefan O'Rear wrote:
| On Mon, Jun 11, 2007 at 09:43:17AM +1000, Thomas Conway wrote:
:
| codeLen 127 = 0
| codeLen 128 = 1
| ...
| codeLen 255 = 8
|
| Now, compiling with ghc 6.6.1 and -O3, I see that it generates a long
| chain of conditional branches.
:
That's deeply tied in
[EMAIL PROTECTED] wrote:
[...]
However, if we try
t2' = W $ id
we get an error:
/tmp/t1.hs:13:
Inferred type is less polymorphic than expected
Quantified type variable `a' escapes
Expected type: (a - a) - b
Inferred type: (forall a1. a1 - a1) - W
In the first argument
Steven Huwig wrote:
On Dec 6, 2004, at 11:05 PM, Tom Pledger wrote:
import Data.Char(isSpace)
import Data.List(groupBy)
(op `on` f) x y = f x `op` f y
wordsAndSpaces = groupBy ((==) `on` isSpace)
`on` is a handy little function in this instance.
Does it have a technical name
Daniel Fischer wrote:
Hi,
I have recently come across the curious phenomenon that ghci is sometimes much
slower than hugs.
[...]
ms as = zipWith (+) (zipWith (*) as (1:ms as)) (0:1:ms as)
Hugs has(**) a specific optimisation for the case where the left hand
side of the declaration occurs as a
Steven Huwig wrote:
[...]
1) Did I miss something in the Prelude or standard library that gives
me this functionality, or something close to it?
[...]
3) The 3-tuple output of unravel looks ugly to me, but I can't think
of an alternative. For the case where there is an equal number of
Keith Wansbrough wrote:
[...]
Your data structure should be something like:
data Interval = Interval {
left :: Double,
leftopen :: Bool,
right :: Double,
rightopen :: Bool
}
data Set = Set [Interval]
If you want more efficiency, you probably want a bintree
MR K P SCHUPKE wrote:
[...]
I dont see why you cannot change the implementation
of lists without changing the interface... Good old lists will
behave like good old lists - just the implementation would try
and take advantage of blocking of the data wherever possible.
Perhaps a pragma to change the
[EMAIL PROTECTED] wrote:
[...]
Actually we merely need to add a deconstructor. Also, we can leave the
type of elements fully polymorphic. Something like this:
class List l where
nil :: l a
cons :: a - l a - l a
decon :: l a
- w -- on empty
- (a - l a - w)
Ron de Bruijn wrote:
--- Martin_Sjögren [EMAIL PROTECTED] wrote:
[...]
mapM_ quickCheck [Test prop_revrev, Test
prop_trivial, Test prop_something]
Regards,
Martin
I didn't expect these replies (including one
mentioning the HList idea(the enforced ordening is
nice, though)), while I tried to be
A.J. Bonnema wrote:
If I use isSpace from the hugs interpretor, it works.
If I use isSpace from a test.hs file I get the error message:
Undefined variable isSpace
From ghc I get the error message:
Variable not in scope: isSpace
What is wrong?
Hugs automatically imports a few extra things as well
Brian Smith wrote:
[...]
instance MonadError (Either ReferenceError)
Kind error: `Either ReferenceError' is not applied to enough type
arguments
When checking kinds in `MonadError (Either ReferenceError)'
In the instance declaration for `MonadError (Either ReferenceError)'
MonadError takes
Nathan Weston wrote:
I am learning haskell (and functional programming), from the School of
Expression book.
There's an exercise to rewrite the following function (for computing the area
of a polygon) using map, fold, etc:
data Shape = Polygon [Vertex]
area (Polygon (v1:vs)) = polyArea vs
Vivian McPhail wrote:
Hi,
From the very helpful posts of John Hughes and others concerning
Monadic Loops, I've been advised to re-implement my neural net
simulator using lazy state threads to avoid crashes to which recursive
(and tail-recursive) monads lead.
I had been using monad
[EMAIL PROTECTED] wrote:
Tom,
Then what will you do when naming operations in a class? Is it right that
care has to be taken in order not to conflict with other classes?
Say, I have a Person class where I want to define an operation getName.
Is it wise to name it getPersonName instead?
Class
John Meacham wrote:
[...]
I find trying to draw analogies between haskell classes and constructs
in other languages to be problematic as people then try to apply
knowledge from other fields incorrectly to haskell unless you give a
full explanation of haskell classes anyway.. but YMMV.
John
[EMAIL PROTECTED] wrote:
Hi, when writing haskell code. It is so annoying that name clashes keep
happening.
I have to be careful about the data constructor names, about the class
names, about the class member names.
[...]
As a novice haskell programmer, I might be missing something here though.
If
Hi.
Another way is to take advantage of Haskell's laziness:
class Foo a where
foo :: a - Int
data Oof1 = Oof1 Int
instance Foo Oof1 where foo (Oof1 i) = i
data Oof2 = Oof2 Int
instance Foo Oof2 where foo (Oof2 i) = i
list1 = [foo (Oof1 10), foo (Oof2 20)]
That's all it takes. The applications
[EMAIL PROTECTED] wrote:
Hi there.
I got this question while I'm messing around with my toy monad.
I was thinking about creating a generic monad that can persist state change
even when fail is called. The StateT monad will discard the state change so
it makes it hard to add tracing to the
Marco Righele wrote:
Hello everyone,
I have some operations that have to be done in sequence, with
each one having the result of the previous as input.
They can fail, so they have signature
a - Maybe b
Checking for error can be quite tedious so I use monadic operations:
f :: a - Maybe b
do
Stefan Holdermans wrote:
Alex,
AG Ignore the layout
AG I can't find the error, running it gives parse error during
AG compile on pStack, it is not very descriptive and I don't
AG what is wrong.
Well, ignoring the layout is not a good thing here, since that's the one of
the causes for your
)
which was quite similar to Cayenne's open ... use ... in ... feature.
Regards,
Tom Pledger
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell
Georg Martius wrote:
[...]
I could write:
modifyT :: ((a, String) - (a, String)) - a - State String a
modifyT trans a = do str - get
let (a', str') = trans (a, str)
put str'
return a'
f :: State String ()
f = do put hallo
modify strTrans
i -
There are a lot of hoaxes on the internet, but just in case you're for
real, here's an idea...
Step 1: Take 20 minutes to get some fresh air.
Step 2: When you get back to your computer, take 5 minutes to read
Desiderata (http://shell.world-net.co.nz/~unikorn/desiderata.htm),
especially the
S. Alexander Jacobson wrote:
In imperative languages, updating an object in a
graph is an O(1) operation. However,
non-destructive update appears to be O(n) with the
size of the graph. For example, suppose we were
to implement an auction system like eBay:
[snip]
One alternative is to store
Wang Meng writes:
:
| class Foo n
| data Erk n = Foo n = Erk
|
| test.hs:53:
| All of the type variables in the constraint `Foo n' are already in
| scope
| (at least one must be universally quantified here)
:
| Is there any reason for this error?
I think it implies that
Armin Größlinger writes:
:
| GHC says
|
| Mismatched contexts
| When matching the contexts of the signatures for
| functions :: Functions
| f2a :: forall a. (Integral a) = a - a
| The signature contexts in a mutually recursive group
| should all be identical
Rafael Martinez Torres writes:
| Hi:
|
| Given the classes IArray,Marray
|
| instance IArray Array.Array
| instance Marray IOArray e IO
|
| I'm searching for some think like
|
| MLists ( Stands for Mutable-Lists )
|
| Is there some thing so ?
|
|
| I need it to implement a
Graham Klyne writes:
:
| Ah, yes. I've grown a little wary of foldl, but I see it's
| appropriate in this case. As it's part of the standard prelude, I
| personally have no qualms about depending upon it ... or should I?
(Hope you don't mind my returning this to haskell-cafe.)
Most of
Graham Klyne writes:
:
| Below is some code I have written, which works, but I'm not sure
| that it's especially efficient or elegant. Are there any published
| Haskell libraries that contain something like this?
Hi.
Partially ordered sets are in cahoots with lattices, so you may be
Hal Daume III writes:
:
| *all* i care about is being able to quickly calculate the size of
| the intersection of two sets. these sets are, in general, very
| sparse, which means that the intersections tend to be small.
|
| for example, i might have two sets reprsented by the arrays:
|
[EMAIL PROTECTED] writes:
| G'day all.
|
| Tom Pledger wrote:
|
| How about adapting splay trees so that their pointers become weak
| after a certain depth? The advantage for caching is that the more
| frequently used elements move closer to the root, so you wouldn't have
| to add
Conal Elliott writes:
| Hi Andrew. This situation is what weak pointers [1] are for. You keep
| weak rather than regular pointers to your cache data. The garbage
| collector clears out the weak pointers and reclaims cache data when
| necessary. However, I don't think there is any policy to
Graham Klyne writes:
:
| What I'd really like to do is assign it to field vbMap, and reference that
| from the definition of vbEnum, but I can't figure out if there's a way
| to do so. Writing this:
| [[
| joinVarBindings vb1 vb2
| | vbNull vb1 = vb2
| | vbNull vb2 = vb1
|
Bayley, Alistair writes:
:
| Still making slow progress on an Oracle database binding... now I'm trying
| to fit the API I have into some sort of abstract interface (like the one(s)
| discussed previously:
| http://haskell.org/pipermail/haskell-cafe/2003-August/004957.html ).
|
|
| 1.
Hi.
Here's another opinion for the Records! Records! chorus:
- The record and module system is one of the two big things I'd like
to see changed in Haskell. (OT: the other is subtyping.)
- It shouldn't happen before Haskell 2, because of backward
compatability. (The dot operator
Hi.
The stream of votes has dried up, and the ICFP people and monthly
digest people have had an opportunity, so here's the collated result.
22 people voted.
(A) Give a perfect answer.
(B) Give a subtly flawed answer.
(C) Give an obfuscated answer.
(D) Give a critique of what the questioner has
Hi.
I'm curious about what the people on this list consider appropriate,
as responses to homework questions. Even if there isn't a consensus,
it may be interesting to see how opinion is divided.
Please consider the following.
(A) Give a perfect answer.
(B) Give a subtly flawed answer.
(C) Give
C T McBride writes:
:
| but I'm not allowed
|
| class Bad x y z | x y - z
|
| instance Functor f = Bad (f x) (f y) Bool
|
| instance Functor f = Bad x (f y) Int
|
| I don't quite see why. Naively, I imagine that if the OK instances are
| effectively prioritized, then Bad's
Konrad Hinsen writes:
| On Thursday 21 August 2003 23:23, Jon Cast wrote:
| I can make such a declaration, but it still gets converted to Double.
|
| How are you doing this? I'm not seeing the behavior you describe.
|
| module Foo where
| x = 0.5 :: Fractional a = a
Try
x ::
Tim Docker writes:
:
| Is it normal or common to support multiple simultaneous queries on
| a single DB connection?
In transaction processing, yes. There's an idiom where you use one
query to select all the (financial) transactions in a batch, but
there's so much variation in how you need to
Tim Docker writes:
:
| The list being folded over
| is implied by the DB query, is accessible through the IO monad.
| Hence a parameter is not required. It would really be:
|
| doquery :: Process - String - b - (b - IO (b,Bool)) - IO b
:
| One thing that I am unsure about is whether the
Tim Docker writes:
| Tom Pledger writes:
|
| This is a pretty good way to stop those nasty vague SQL row types at
| the Haskell border and turn them into something respectable. Perhaps
| it would even be worth constraining the extracted type to be in
| DeepSeq
|
| doquery
Thomas L. Bevan writes:
| Does anyone know if there is work being done on a standard Haskell
| database interface.
I suspect that there isn't. The pattern seems to be that someone gets
an interface working well enough for some purposes, and perhaps shares
it, but is too modest and/or busy to
Johannes Waldmann writes:
:
| spaces 0 =
| spaces n = ' ' : spaces (n - 1)
|
| this should be replicate n ' ' or something
| that behaves nicely for negative arguments.
Like an n+k pattern? ;-)
___
Glasgow-haskell-users mailing list
K. Fritz Ruehr writes:
:
| But Jerzy Karczmarczuk enlightened me as to the full generality possible
| along these lines (revealing the whole truth under the influence of at
| least one beer, as I recall). Namely, one can define a sequence of
| functions (let's use a better notation now, with
Robert Vollmert writes:
| Hello,
|
| I've been having a little trouble writing a module that waits for and
| handles IO events, e.g. by reading from a pipe. It seemed natural to
| use some form of callbacks here, though that may very well be the
| wrong approach. I'd be happy to hear of
Niall Dalton writes:
| Hi,
|
| Its been a while since I've been using Haskell seriously, so I might simply
| have overlooked the answer..
|
| Is there an arbitrary precision real number library available for Haskell?
| IIRC, atleast GHC uses the GMP library, but only for integers?
Hi.
Graham Klyne writes:
| In the function body (rhs):
|
| let
| { a = (e1) }
| in
| (e2)
| where
| { b = f a }
:
| comment
:
| I now see that use of 'where' is restricted to specific contexts. I wonder
| if such restriction is needed?
I've replied to this in haskell-cafe.
Alexandre Weffort Thenorio writes:
:
| But I get this error saying:
|
| Expected Type: [String]
| Inferred Type: String
:
___
Haskell mailing list
[EMAIL PROTECTED]
(moving to haskell-cafe)
Alexandre Weffort Thenorio writes:
| Ooops a small error before but here is the right one.
|
| Great. I got almost everything. My problem now is:
|
| I got a function called findstr where
|
| findstr z [,xxxxxx] =
| [z,xxxzxxx]
Wang Meng writes:
| Hi All,
|
| Any one of your have the experience of defining a state of a state monad
| as a polymorphic type?
| I want to have:
|
| type State = Term a = [a]
| data M a = M (State - IO(State,a))
|
| GHC yields a error message Illegal polymorphic type.
| How to
Dean Herington writes:
:
| My question came up in the context of describing such an abstract type for
| users of the type. Like many others, I like to include actual Haskell
| code where appropriate in the documentation. It didn't seem right to
| commit there to either `data` or `newtype`.
Hal Daume III writes:
:
| So, you're probably better off with:
|
| nco wn = nco'
| where wn' = cis wn
|nco' = 1 : map (wn'*) nco'
|
| In which case it will only be evaluated once.
The following version also evaluates 'cis wn' only once.
nco wn = iterate (cis wn *) 1
I've
A third way is to put each datatype declaration in a separate module and
use qualified imports.
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell
Cai john writes:
:
| what I want to do is eliminate b,c d into a
| recursive function:
|
| insertList tree [] = Empty
| insertList tree (x:xs) = insertList(insert tree x)
|
| but hugs is complaining about a top-level overloading
| error.Any idea how to fix it, thanks.
I don't see
Nick Name writes:
:
| Ok I can't resist longer. It's ages I have been wondering what's a
| catamorphism, and an anamorphism, and what the hell does it mean
| data is expressed by destructors and not by constructors, but I
| have had no time till now. Please some of you all catamorphism
|
John Meacham writes:
:
| another useful thing would be
| endOfTime and beginningOfTime constants, representing the minimum and
| maximum values representable by ClockTime.
:
| ___
| Haskell mailing list
| [EMAIL PROTECTED]
|
Tim Otten writes:
:
| Can anyone suggest why the tighter algorithm exhibits significantly
| worse performance? Is takeWhile significicantly more expensive than
| take?
No.
| Is the \z lambda expression expensive?
No.
| The intsqrt isn't recalculated each time takeWhile evalutes a
|
Tom Pledger writes:
| Tim Otten writes:
| :
| | Can anyone suggest why the tighter algorithm exhibits significantly
| | worse performance? Is takeWhile significicantly more expensive than
| | take?
|
| No.
Correction (before anyone else pounces on it):
Only if the predicate function
Scott J. writes:
:
| Sill I want to make objects packed with their objects and
| functions. Doesn't mean that I have to use existential data types?
Sometimes you can avoid using existentials by making all your
object-updating functions return the post-update object explicitly.
For example:
Shawn P. Garbett writes:
:
| What I want is something like this, so that the state transformer has a
| generic state type:
|
| newtype St a s = MkSt (s - (a, s))
|
| apply :: St a s - s - (a, s)
| apply (MkSt f) s = f s
|
| instance Monad St where
| return x = MkSt
Hal Daume III writes:
| Hi all,
|
| I'm looking for some advice on what's the cleanest way to implement
| something.
:
| where the main driver does something like:
|
| prepareData
| initialize
| iterate until converged
| doThingOne
| doThingTwo
| getResults
|
|
Mark Fielder writes:
| How does Haskell provide encapsulation? What mechanisms does it
| use?
The ways that spring to mind are modules and nested declarations:
http://haskell.cs.yale.edu/onlinereport/modules.html
http://haskell.cs.yale.edu/onlinereport/decls.html#sect4.4
| What are
From: Cagdas Ozgenc [EMAIL PROTECTED]
| Greetings.
|
| What happens if a type is made an instance of a typeclass in two
| different modules with different implementations?
That's OK, provided that the two instance declarations are never in
scope together, i.e. neither of the modules imports
Andre W B Furtado writes:
| I was visiting http://www.ai.mit.edu/extra/icfp-contest/ and noticed that
| there was a functional programming contest in ICFP 98. I'd like to know if
| there are any periodic functional progamming contests around the world, such
| as the ACM contest for the C
Joe English writes:
:
| Suppose you have two morphisms f : A - B and g : B - A
| such that neither (f . g) nor (g . f) is the identity,
| but satisfying (f . g . f) = f. Is there a conventional name
| for this?
Is it equivalent to saying that (f . g) is the identity on the range
of f?
Cagdas Ozgenc writes:
| Greetings.
|
| How can I make all types that belong to class A and instance of
| class B, if the implementations of functions in class B can be
| realized by only using the functions in class A?
|
| Thanks for taking time.
Something like this, you mean?
Ludovic Kuty writes:
:
| Is it an idiom or some sort of optimization ?
It's more to do with the particular algorithm for finding the area of
a convex polygon. Try working through the calculation of the area of
this kite.
Polygon [(0, 0), (1, 0), (2, 2), (0, 1)]
I think the two versions
Andre W B Furtado writes:
:
| Of course, it is possible to do something like
|
| update :: MyType - Int - MyType
| update mt newValue = MT {x = newValue, y = oldValue}
| where oldValue = y mt
|
| but this really annoys me when MyType has too many fields. Suggestions?
update mt
Nguyen Phan Dung writes:
:
| mylist :: [Integer]
| mylist = [1..10]
|
| In Hugs, I type mylist to print out all the elements inside. However,
| after printing about 22000 elements, the system crashs outputs:
| Garbage collection fails to reclaim sufficient memory
The declaration
Nguyen Phan Dung writes:
:
| mylist :: [Integer]
| mylist = [1..10]
|
| In Hugs, I type mylist to print out all the elements inside. However,
| after printing about 22000 elements, the system crashs outputs:
| Garbage collection fails to reclaim sufficient memory
The declaration
David Feuer writes:
:
| Question: Is there any standard way in Haskell of determining the
| maximal and minimal Int values?
Yes, instance Bounded Int, which means you can use
maxBound :: Int
and
minBound :: Int
___
Haskell mailing list
C T McBride writes:
:
| A little more tinkering, and it looks like it might be
|
| show :: Show (f (Wonky f)) = Wonky f - String
|
| Is this really the type of show?
That looks correct to me.
| If so, no wonder there's a problem.
Yes, there's a vicious circle in context reduction,
Tom Pledger writes:
| C T McBride writes:
| :
| | A little more tinkering, and it looks like it might be
| |
| | show :: Show (f (Wonky f)) = Wonky f - String
| |
| | Is this really the type of show?
|
| That looks correct to me.
Well, after the first context reduction
Mark Wotton writes:
| Hi,
|
| I'm trying out some combinatorial parsers, and I ran into a slightly
| inelegant construction. To parse a sequence of things, we have a function
| like
|
| pThen3 :: (a-b-c-d) - Parser a - Parser b - Parser c - Parser d
| pThen3 combine p1 p2 p3 toks =
|
Andre W B Furtado writes:
| Roughly speaking, I'm in need of a monad (say MyIO) that interprets the
| following code
|
| f :: MyIO ()
| f = do
| action1
| action2
| action3
| ...
| return ()
|
|
| as applying action1 to g, then action2 to
Hal Daume III writes:
| 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 a List of
Simon Peyton-Jones writes:
:
| A key design choice in our system is to use *nominal* not *structural*
| typing. The structural choice makes perfect sense, but it leads to
| complications we don't have (as well as benefits). So we don't have
| structural subtyping, and it would not be easy
Jan-Willem Maessen writes:
| * Split the Enum class into two. Possibly correspondence with Int
| belongs in Bounded---but it depends what you think Bounded
| means.
FWIW I sometimes use a data type for the very purpose of adding bounds
to an open-ended type.
data Close a
=
Raul Sierra writes:
| Hi all,
|
| What is the difference between regular classes and constructor classes
| and how do you specify that a class is a constructor class?
|
| Thanks in advance,
| Raul
The term `constructor class' is meant to include classes like Functor
and Monad, whose
Andre W B Furtado writes:
:
| copyFile :: String - String - IO String
| copyFile [] s = return (reverse s)
| copyFile (a:as) s = copyFile as ( (doSomeStuffWith a):s)
:
| For example, suppose function doSomeStuffWith returns its own
| parameter. Using a 1.5MB file in this case, the Haskell
Thanks for the further explanation, Marcin. If I understand
correctly, you're talking about explicitly named algebraic types, not
just unions where the type is an anonymous reflection of the structure
as in:
Var (foo :: Int, bar :: Char)
-- in the style of A Polymorphic Type System for
Marcin 'Qrczak' Kowalczyk writes:
:
| Since OO languages often use subtypes to emulate constructors of
| algebraic types, they need downcasts. In Haskell it's perhaps less
| needed but it's a pity that it's impossible to translate an OO
| scheme which makes use of downcasts into Haskell in
Just as a matter of idle curiosity, is there a particular reason for
tuples starting at element 1 (fst) whereas lists start at element 0?
fst ('x', 'y') -- 'x'
xy !! 1 -- 'y'
___
Haskell mailing list
[EMAIL PROTECTED]
Thanks for the replies. I keep forgetting to read (!!1) as the
element at 1 and not as the 1st element.
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell
Norman Ramsey writes:
:
| how can I show that if a type has class Real, it also has class
| Random.Random? Is there a way to accomplish this goal other than
| by changing the library?
How about the default-implementations-as-external-functions approach
Marcin suggested, adapted for Real
Zhanyong Wan writes:
:
| I can't help wondering why it isn't
|
| deleteBy' :: (a - Bool) - [a] - [a]
| deleteBy' f [] = []
| deleteBy' f (y:ys) = if f y then ys else
| y : deleteBy' f ys
deleteBy'' f = filter (not . f)
Malcolm Wallace
Zhanyong Wan writes:
| Tom Pledger wrote:
:
| deleteBy'' f = filter (not . f)
|
| No. deleteBy' f only deletes the *first* element that satisfies the
| predicate f, while filter (not . f) deletes *all* such elements.
Oops. Sorry. I ought to become less SQL-oriented
David Bakin writes:
:
| I have been puzzling over this for nearly a full day (getting this
| reduced version from my own code which wasn't working). In
| general, how can I either a) analyze code looking for a space leak
| or b) experiment (e.g., using Hugs) to find a space leak? Thanks!
1 - 100 of 170 matches
Mail list logo