Peter Hercek wrote:
f = g . transform displacement . scale factor
or pointfully
f x = g (transform displacement (scale factor x))
with the appropriate combinators.
Essentially the same idea as the one from Brent Yorgey.
Works fine till the operations can fill easily on one line. Then it does
Peter Hercek wrote:
Jules Bean wrote:
I have no idea what you're talking about. It works fine on multiple
lines:
f x = g
. transform displacement
. scale factor
$ x
is perfectly valid.
Yes, it is. It is not an issue if you prefer to indent based on previous
line
David Benbennick wrote:
You mean (++) = mplus. I've wondered that too. Similarly, one should
define map = fmap. And a lot of standard list functions can be
generalized to MonadPlus, for example you can define
filter :: (MonadPlus m) = (a - Bool) - m a - m a
Somehow this filter fails my
ok wrote:
On 5 Sep 2007, at 6:16 pm, Henning Thielemann wrote:
I think it is very sensible to define the generalized function in
terms of the specific one, not vice versa.
The specific point at issue is that I would rather use ++ than
`mplus`. In every case where both are defined, they
Ketil Malde wrote:
String is not an instance of class Foo -- single param
No instance for (Bar String Int)-- multi-param
If you quote things, you can also consider:
'String Int' is not an instance of class 'Bar'.
Downside is that 'String Int' by
Axel Gerstenberger wrote:
Thanks to all of you. The suggestions work like a charm. Very nice.
I still need to digest the advices, but have already one further
question: How would I compute the new value based on the 2 (or even
more) last values instead of only the last one?
[ 2, 3 , f 3 2,
Adrian Neumann wrote:
For example, the internet states, that the magic number, that puts 'BM'
in the first two bytes of the file is 19778. But when I
put (19778::Word16)
I get 'MB' instead. I read on the german Wikipedia, that bmp uses little
endian encoding, but Data.Binary uses big endian.
Thomas Schilling wrote:
On Mon, 2007-09-10 at 11:10 +0100, Jules Bean wrote:
The docs are not as well interlinked as you might hope.
In fact, the docs on hackage are interlinked nicely. That is, for
packages for which the documentation builds.
On the documentation page:
http
Ketil Malde wrote:
On Tue, 2007-09-11 at 09:10 +0200, Sven Panne wrote:
foo :: Binary a = ... - a - ...? This should probably mean foo is
using some portable (de-)serialization, but doesn't care about the
actual representation,
I'm probably missing something, but:
How can the format be
Ketil Malde wrote:
On Tue, 2007-09-11 at 12:01 +0100, Jules Bean wrote:
How can the format be portable if the representation isn't unambigously
defined? And if it is unabmigously defined, what's wrong with using it
for externally defined data formats?
It's portable because it works on other
Andrew Coppin wrote:
OTOH, I recently discovered that GHCi has the ability to show you what's
defined in a given module without me having to wait 40 seconds for
Firefox to start... Shame you can't scroll its output. (And still no
help if you're not sure of the module name.)
!!!
Run ghci in
Greg Meredith wrote:
Haskellians,
Am i wrong in my assessment that the vast majority of reflective
machinery is missing from Haskell? Specifically,
* there is no runtime representation of type available for
programmatic representation
* there is no runtime representation of the
Bryan O'Sullivan wrote:
(All of the above speaks of the 'high-level' Data.Binary not the
'low-level'.)
Data.Binary *is* the low-level Data.Binary :-)
I was distinguishing between these two levels:
(1) High-level = Binary typeclass. Contains instances for many, many
useful common types, the
VinyleEm wrote:
Hello all, I am Vinay Emani, new to this forum. I am doing an academic
project of writing an assembler cum linker in Haskell as part of building a
compiler set written entirely in Haskell. Since i am new to the language, i
thought it would do me good to look at some of the
David Benbennick wrote:
On 9/12/07, Andrea Rossato [EMAIL PROTECTED] wrote:
If I run it in a console I get
abAAA (sort of) no matter what my LANG is - 8 single 8 -bit
characters.
It's possible to set your Linux console to grok UTF8. I don't
remember the details, but I'm sure you can Google
Neil Mitchell wrote:
Hi
A more serious point is that in some cases we might want take to
underapproximate, or zip to truncate (or tail [] = [] ?). I don't
think there's
always a clear library choice here.
I have a zipWithEq function I often use, which crashes if the zip'd
lists aren't equal.
Neil Mitchell wrote:
Hi
Although I appluad the semantics of the safe package, I'm not delighted
with the idea of replacing our concise elegant standard library names
with uglyAndRatherLongCamelCaseNamesThatCouldBePerlOrEvenJava though.
Conciseness of expression is a virtue.
They aren't that
Jeff Polakow wrote:
Hello,
There are 4 variants of tail:
tail :: [a] - [a] -- normal
tailDef :: [a] - [a] - [a] -- returns the first argument on []
tailMay :: [a] - Maybe [a] -- returns a Nothing
tailNote :: String - [a] - [a] -- crashes, but with a helpful message
tailSafe ::
The OpenGL bindings which come bundled with ghc are a really great
example of how even an almost-literal port of a C API can still
be easier to work with in haskell than it is in C, because of the
benefits of type inference and powerful abstractions. Even the
ability to mapM_ is a tool to make C
Peter Verswyvelen wrote:
Maybe this is a stupid question, but I don't find something similar in
Haskell.
I find mod and rem, which work on integers. But I'm looking for a
function similar to C's fmod.
Of course I can write it myself, but I guess it must already exist under
a different
Simon Marlow wrote:
Ashley Yakeley wrote:
If I have a thread that's blocked on an STM retry or TChan read, and
none of its TVars are referenced elsewhere, will it get stopped and
garbage-collected?
I have in mind a pump thread that eternally reads off a TChan and
pushes the result to some
Andrea Rossato wrote:
I'm not even sure if this message will get through. Actually this is
the only mailing list I have some problem with... perhaps some filter
may be considering my messages as spam. I'd like to have a copy of
that filter installed on my system!
I saw it. In total, four
Vimal wrote:
From the wiki:
If you write it, you force Haskell to create all list nodes. ...
Alright.
Now, lets look at the definition again:
length [] = 0
length (x:xs) = 1 + length xs
We see that the value of *x* isnt needed at all. So, why does GHC
allocate so much memory creating all
Chuk Goodin wrote:
I have a list of lists of pairs of numeric Strings (like this:
[[2,3],[1,2],[13,14]] etc.) I'd like to change it into a
list of a list of numbers, but I'm not sure how to go about it. If it
was just one list, I could use map, but map.map doesn't seem to work.
Any
bbrown wrote:
I am going to be doing a lot of opengl stuff in haskell and so far one thing
has irked me. Why does haskell keep the GLFloat and GL types and not just
the Haskell types.
It mirrors the C API in doing so.
I assume that this is because, in principle a system might exist where
PR Stanley wrote:
Yes and thanks for the reply.
When a function is declared in C the argument variable has an address
somewhere in the memory:
int f ( int x ) {
return x * x;
}
any value passed to f() is assigned to x. x is the identifier for a real
slot in the memory (the stack most likely)
Lots of external libraries contain state, but one that really contains a
*lot* of state is the OpenGL libraries, since OpenGL is specified as a
statemachine.
This means that when you're writing structured code you quite often want
to save and restore chunks of state 'automatically'. For the
Spencer Janssen wrote:
On Tuesday 02 October 2007 19:51:47 Anatoly Yakovenko wrote:
If its specifically the list instance, where we currently trade laziness
for efficiency of encoding (which may or may not be the right thing),
I'd suggest a fully lazy encoding instance?
Its not really a list,
Thomas Conway wrote:
On 10/4/07, Jules Bean [EMAIL PROTECTED] wrote:
...and indeed it can't be done, except by the naive brute-force method
of comparing every subtree, possibly optimised by cryptographically
hashing a representation of every subtree, since sharing isn't an
observable property
Stefan O'Rear wrote:
Calling Haskell code from the garbage collector is essentially
impossible to do efficiently and correctly. Don't even try it, your
sanity is not worth saving 3 lines of C coding.
It is a sad thing indeed if that is correct advice.
Jules
[EMAIL PROTECTED] wrote:
Somehow I do not only think that the default implementation would be good
for nothing, but that putting PI into Floating as a class member, serves
nobody.
Are you aware that it already is in the Floating class?
This discussion is not about adding it, but about whether
[EMAIL PROTECTED] wrote:
This discussion is not about adding it, but about whether or not it
should have a default.
Are you suggesting pi should be removed from the Floating class?
Then, what type would you give pi?
First, I don't care whether it is there or not. When I use it, I define
a
Yitzchak Gale wrote:
How about a built-in function that represents a directory tree
as a lazy Data.Tree?
Please no.
The last thing haskell needs is more dangerous semantically broken
non-referentially-transparent lazy IO structures.
Jules
___
Ryan Bloor wrote:
Hi, its Ryan here...
I've just come from an intensive course in java and have been thrown
into the imperative world of haskell.
The problem that I have is extremely simple in java but I am having
trouble adjusting my old mindset.
A multiset is a collection of items.
Each
John Goerzen wrote:
Many systems will just try to close *all* FDs except the ones they need
after a fork(). Another approach would be to maintain a global list of
FDs that the Haskell thread is using, and close all of them except the
pipe ends in the child.
Does this make sense to everyone?
Is there some (easy) way to avoid this while still using readFile?
readFile' f = do s - readFile f
return (length s `seq` s)
(and curse the fact that the default readFile is unsafelazy).
Jules
___
Haskell-Cafe mailing list
Magnus Therning wrote:
On Thu, Oct 18, 2007 at 12:05:40 +0100, Jules Bean wrote:
Is there some (easy) way to avoid this while still using readFile?
readFile' f = do s - readFile f
return (length s `seq` s)
(and curse the fact that the default readFile is unsafelazy
Simon Peyton-Jones wrote:
Good idea. GHC uses it
http://darcs.haskell.org/ghc/compiler/basicTypes/UniqSupply.lhs
Lennart Augustsson and friends invented it
@techreport{Augustsson92a,
...
You know what would be really nice? A summary of here are all the
really cool tricks we use in
[EMAIL PROTECTED] wrote:
*PLEASE*, show me untrustworthy Wikipedia pages.
Any article on a disputed territory or open political dispute.
Most articles on a controversial philosophy.
Many articles on living people.
I hope I don't have to give examples. Certainly I don't wish to discuss
any
Sebastian Sylvan wrote:
On 19/10/2007, Kalman Noel [EMAIL PROTECTED] wrote:
data ExistsNumber = forall a. Num a = Number a
I'm without a Haskell compiler, but shouldn't that be exists a.?
IIRC forall will work too, but the right way to do it is exists,
right?
No. It's been suggested but
I agree with Matthew's comments in the post immediately before this. It
takes him two decent paragraphs to explain what is going on, including a
description of WHNF, a suggestion to use pen paper, a suggestion to
read up on the semantics of unsafeInterleaveIO and more.
What I find
Maxime Henrion wrote:
Hello all,
What do you think about having a wordsBy function in the standard
libraries? It often comes in handy.
I speculate (but don't know) that the reason we don't have one is that
there are quite a few choices to make:
* delimiter as function (Char -
Short answer: You are worrying about syntax. The things you want are
possible.
TJ wrote:
Following up on my previous thread, I have figured out why it bothered
me that we cannot have a list such as the following: [abc, 123, (1,
2)] :: Show a = [a]
That type doesn't mean what you want it to
TJ wrote:
No. I am saying that Haskell's type system forces me to write boilerplate.
Fair enough.
Why can't it automatically construct them then? Assuming we do have a
syntax for A list of objects, each of which is of some
possibly different type 'a', subject only to the restriction that a
John Lato wrote:
I'm working
with moderate-sized files (tens to hundreds of MBs) that have some
ascii header data followed by a bunch of 32-bit ints.
but I don't know if [Int32] is actually the best choice. It seems to me
that something like a lazy list of strict arrays (analogous to a lazy
Isaac Dupree wrote:
When I try to go to one of the Module.hs files, e.g. on
darcs.haskell.org, it now has type HS and Firefox refuses to display it
(and only lets me download it). Does anyone know how to make Firefox
treat certain file types as others (HS as plain text, in particular)? so
Paulo J. Matos wrote:
type system? Why is that? Shouldn't type system in fact speed up the
generated code, since it will know all types at compile time?
The *existence* of a type system is helpful to the compiler.
Peter was referring to the differences between haskell and clean.
Robin Green wrote:
On Wed, 31 Oct 2007 14:17:13 +
Jules Bean [EMAIL PROTECTED] wrote:
Specifically, clean's uniqueness types allow for a certain kind of
zero-copy mutation optimisation which is much harder for a haskell
compiler to automatically infer. It's not clear to me that it's
David Carter wrote:
readdirAll :: PD.DirStream - IO [String]
readdirAll d =
do dir - PD.readDirStream d
if dir ==
then return []
else rest - readdirAll d
return (dir:rest)
Compiling with GHC 6.6.1 gives me the not-very-useful message Parse
error in pattern,
It's much much easier to work with n-ary than binary.
It's also easier to define disjunctive normal form by mutual recursion
with conjunctive normal form.
Jules
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Can you please give me some hint to solve this problem?
I'm a beginning haskell developer and I'm still a bit confused
by the IO monad.
Other people have explained to the OP why unsafe lazy IO is breaking his
code.
Yet another piece of evidence, in my opinion, that
unsafe-lazy-by-default is
Brandon S. Allbery KF8NH wrote:
On Nov 3, 2007, at 5:34 , Andrew Coppin wrote:
(BTW, anybody have any clue what's happening with stream fusion? I
remember reading the paper saying hey, this is how it works and it's
cool and we're going to try to replace the whole list library with new
Levi Stephen wrote:
Hi,
I'm was wondering how most people work during when designing a
functional program. Do you create data structures/types first? Do you
work from some type signatures?
For example, take a blog. Is the first step likely to be something like:
data BlogEntry = BlogEntry {
Joel Reymont wrote:
Is there such a thing as memory-mapped arrays in GHC?
In principle, there could be an IArray instance to memory-mapped files.
(There could also be a mutable version, but just the IArray version
would be useful).
I noticed just the other day that there are some 'obvious'
Aaron Denney wrote:
It may be that by opening it in write mode you could ensure that noone else
modifies it (although I don't think this would work e.g. on nfs),
It doesn't even work locally.
Right. But mmap is only sensible to use (even in C) when you know about
all the other processes
Brent Yorgey wrote:
More generally, this is due to the fact that floating-point numbers can
only have finite precision, so a little bit of rounding error is
inevitable when dealing with irrational numbers like pi. This problem
is in no way specific to Haskell.
But some systems always
Laurent Deniau wrote:
Henning Thielemann wrote:
On Tue, 13 Nov 2007, Jon Harrop wrote:
On Tuesday 13 November 2007 08:41, Henning Thielemann wrote:
On Tue, 13 Nov 2007, Jon Harrop wrote:
Penetration is highest in parts of industry where small groups of
talented programmers get together,
Simon Peyton-Jones wrote:
| For technical reasons, GHCi can only support the *-form for modules
| which are interpreted, so compiled modules and package modules can
| only contribute their exports to the current scope. But it does mean
| the interpreter isn't referentially transparent, which is
Aaron Denney wrote:
On 2007-11-13, Jules Bean [EMAIL PROTECTED] wrote:
Simon Peyton-Jones wrote:
| For technical reasons, GHCi can only support the *-form for modules
| which are interpreted, so compiled modules and package modules can
| only contribute their exports to the current scope
Henning Thielemann wrote:
On Tue, 13 Nov 2007, Dougal Stanton wrote:
On 13/11/2007, Henning Thielemann [EMAIL PROTECTED] wrote:
On Tue, 13 Nov 2007, Dougal Stanton wrote:
-- int a = 3;
-- int *pa = a;
ampersand :: t - Pointer t
ampersand a = Just a
What's bad about using 'ampersand'
Simon Marlow wrote:
The only problem with this is that someone who isn't aware of this
convention might accidentally be ignoring compiled code, or might wonder
why their compiled code isn't being used. Well, perhaps this is less
confusing than the current behaviour; personally I find the
John Lato wrote:
This actually clears up something that's been bothering me for some
time. I've never really like syntax of types for functions with
multiple arguments. Using the same token, -, to separate both
arguments and the result seems very poor, because when reading a type
you don't
Andrew Coppin wrote:
GLUT and GLX will also work, and at least the former has a Haskell
binding.
As far as I'm aware, GLUT isn't available for Windows. (Or rather, I
tried it once, and it wasn't happy at all. And after some Google
searching, I found it's not around any more.)
As far as
Peter Verswyvelen wrote:
Yes indeed, and various implementations of GLUT on Windows have
different quirks.
The biggest lack of GLUT is its inability to load images...
IMHO if you want to do OpenGL with Haskell, it's best to start with
Gtk2HS anyway, which has all the support needed.
..at
Peter Verswyvelen wrote:
No GLUT is not bundled with GHC 6.8.1 anymore. Yes, that is weird.
I think it's weird too, so I bug reported it:
http://hackage.haskell.org/trac/ghc/ticket/1917
Jules
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Maurício wrote:
Hi,
How can I call a program (like, for instance,
'grep text *') and get the standard output?
All actions I found (executeFile, system) do
not give me the output of the program.
http://haskell.org/ghc/docs/latest/html/libraries/process-1.0.0.0/System-Process.html
module Main (Main.main) where
import Control.Monad
import System.IO
(*) :: Monad m = m () - (a - m ()) - (a - m ())
(*) f f' = \a - do{
f;
f' a;
}
main :: IO ()
main = mapM_ ((putStrLn ) * putStrLn) $
map show [1,2,3]
There is nothing wrong with that, but I would normally write:
Maurício wrote:
Hi,
If I have two computations a-IO b
and b-IO c, can I join them to
get an a-IO c computation? I imagine
something like a liftM dot operator.
You've already been shown the = operator and how to define it from =
by other answers.
Just for variety, here is how you would
Josh Lee wrote:
On Tue, 27 Nov 2007 14:41:59 -0500
Isaac Dupree [EMAIL PROTECTED] wrote:
Henning Thielemann wrote:
On Mon, 26 Nov 2007, Jason Dusek wrote:
Among numeric types, it seems that only integer types are Bounded.
Maybe because IEEE format supports Infinity?
therefore, maxBound is
Maurício wrote:
Hi,
'takeMVar' documentation says if there are
multiple threads blocked in takeMVar, and the
MVar becomes full, only one thread will be
woken up.
Since 'takeMVar' is a reading function, i.e.,
it doesn't change the value of the
variable, why waking up only one thread? If
we
Henning Thielemann wrote:
I thought operations like foldl' and drop must be very fast on arrays
(especially UArray) with appropriate pointer tricks, I mean pointer
incrementing instead of indexing for foldl' and a pointer into the array
for drop. Is it planned to add such functions? Ok, if foldl
Duncan Coutts wrote:
On Wed, 2007-11-28 at 17:38 -0200, Maurício wrote:
(...) When it's phrased as truncates to 8
bits it sounds so simple, surely all we need
to do is not truncate to 8 bits right?
The problem is, what encoding should it pick?
UTF8, 16, 32, EBDIC? (...)
One
Ben Franksen wrote:
I don't buy this. As has been noted by others before, IO is a very special
case, in that it can't be defined in Haskell itself, and there is no
evaluation function runIO :: IO a - a.
This is a straw man. Most monads will not have such a function:
There is no function
Felipe Lessa wrote:
On Dec 4, 2007 1:28 AM, Don Stewart [EMAIL PROTECTED] wrote:
-- How to display results
instance Show Action where
show MoveOutOfBounds= Sorry you can't move in that direction.
show (MoveBadTerrain a) = case a of
Andrew Coppin wrote:
Andrew Coppin wrote:
copy :: Word32 - IOUArray Word32 Bool - Word32 - IO (IOUArray
Word32 Bool)
copy p grid size = do
let size' = size * p
grid' - newArray (1,size') False
mapM_
(\n - do
b - readArray grid n
if b
then mapM_ (\x - writeArray grid' (n
Paulo J. Matos wrote:
Hello all,
Hi.
findAllPath :: (a - Bool) - (BTree a) - Maybe [[a]]
findAllPath pred (Leaf l) | pred l = Just [[l]]
| otherwise = Nothing
findAllPath pred (Branch lf r rt) | pred r = let lfpaths = findAllPath pred lf
Alistair Bayley wrote:
Nested Maybe cases put me in mind of the Maybe monad. Although in this
case it''s not trivial; we also need to involve the Maybe [a] instance
of Data.Monoid too (for the mappend function). I do wonder if I'm
abusing the monadic instances of Maybe though; is this really any
Peter Padawitz wrote:
Yes, the recursive calls of compCommand are supposed to be calls of
compBlock.
The intention of the program is a generic evaluator comp... of
Sigma-terms in arbitrary Sigma-algebras. The signature Sigma is given by
the first 4 types (and the corresponding functions in
ChrisK wrote:
A safer gimmick...
Ben Franksen wrote:
tickWhileDoing :: String - IO a - IO a
tickWhileDoing msg act = do
hPutStr stderr msg hPutChar stderr ' ' hFlush stderr
start_time - getCPUTime
tickerId - forkIO ticker
... an async exception here will leave the ticker runnning
david48 wrote:
Threads won't give you a speedup unless you run the program on a
multi-core/multi-proc machine.
That's actually not true. Threads allow you managing your IO blocking
better, and not making IO block your whole program can certainly speed
it up by a couple of orders of
Ben Franksen wrote:
Ryan Ingram wrote:
On 12/5/07, Ben Franksen [EMAIL PROTECTED] wrote:
You would have to use functional dependencies or associated types to
eliminate this error. Alternatively, you can add a dummy argument of type
block and pass undefined :: BlockType in to help choose the
Peter Padawitz wrote:
Functional dependencies don't work in my case. Actually, I don't see why
they should.
Ah well, it's cruel to say that without explaining to us why!
I'm not sure why a complete cyclic dep a - b - c - d - a isn't what
you want.
What seems to be needed here is a type
Peter Padawitz wrote:
Jules Bean wrote:
Peter Padawitz wrote:
Functional dependencies don't work in my case. Actually, I don't see
why they should.
Ah well, it's cruel to say that without explaining to us why!
Cause I don't see why the instantiation conflicts pointed out by others
Peter Padawitz wrote:
So the fundep would solve the problem.
But, actually, it doesn't :-(
But actually, it does!
Ben Franksen's answer from yesterday compiles fine for me if I add the
missing fundep, block - command.
Your original code compiles without error, given the fundep. Exact
Bit Connor wrote:
On Dec 8, 2007 10:15 PM, Andrew Coppin [EMAIL PROTECTED] wrote:
Bit Connor wrote:
On Dec 8, 2007 8:19 PM, Andrew Coppin [EMAIL PROTECTED] wrote:
http://alts.homelinux.net/shots/195-0.jpg
This is the kind of thing I'd like to end up with.
Such a GUI would also be cool for
Try again without missing out the list...
Peter Padawitz wrote:
Jules Bean wrote:
Incidentally, I question why the compFoo are methods. Why not just
make them polymorphic functions? They don't look like you expect
instances to change them. The code continues to compile if I make them
David Fox wrote:
Here is a practical example I ran into a few days ago. With this
expression:
writeFile path (compute text)
the file at path would be overwritten with an empty file if an error
occurs while evaluating (compute text). With this one:
writeFile path $! (compute text)
Peter Padawitz wrote:
What is so bad about making compFoo part of the class? It reduces the
code (constraints can be avoided) and reflects the close connection
between a signature Sig (implemented by the class) and the evaluation
(compFoo) of Sig-terms in Sig-algebras.
making it part of the
Peter Padawitz wrote:
Jules Bean wrote:
Peter Padawitz wrote:
What is so bad about making compFoo part of the class? It reduces the
code (constraints can be avoided) and reflects the close connection
between a signature Sig (implemented by the class) and the
evaluation (compFoo) of Sig
David Menendez wrote:
On Dec 11, 2007 9:20 AM, Duncan Coutts [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
So my suggestion is that we let classes declare default implementations
of methods from super-classes.
snip.
Does this proposal have any unintended consequences? I'm not
Evan Laforge wrote:
it seems that script may be not terminated if its output isn't read, so
better code should be
(_, h, g, _) - runInteractiveCommand script params
result - hGetLine h
hGetContents h = evaluate.length
hGetContents g = evaluate.length
Tangent here, but does anyone else think
Dan Weston wrote:
apfelmus wrote:
Luke Palmer wrote:
Isn't a type which is both a Monad and a Comonad just Identity?
(I'm actually not sure, I'm just conjecting)
Good idea, but it's not the case.
data L a = One a | Cons a (L a) -- non-empty list
Maybe I can entice you to elaborate
Peter Padawitz wrote:
I'd like to define several instances of the same type class with the
same type variable instance. Only method instances differ. How can I do
this without writing copies of the type class?
newtypes and modules have both been suggested.
I have another suggestion:
Don't!
Tim Chevalier wrote:
It sounds like Team GHC is thinking about the exact same things you are here:
http://hackage.haskell.org/trac/ghc/wiki/Status/Nov07
Thanks for posting that. I was unaware of that link, and it was very
interesting reading.
Jules
Jack Kelly wrote:
struct room{
...
struct player * players;
...
};
struct player{
...
struct room * room;
...
};
From what I can see, I'd use a record type for players and rooms, but
I'm not sure how to replicate the pointer effects:
Essentially you have to choose some form of
[EMAIL PROTECTED] wrote:
Roberto Zunino writes:
without seq, there is no way to distinguish between undefined and (const
undefined),
no way to distinguish is perhaps too strong. They have slightly
different types.
At a particular type which they both inhabit, such as (a-b) or, to be
Peter Verswyvelen wrote:
Very interesting, I did not know that!
I thought newtype was an optimization of data, and that newtype was bad
terminology. But if newtype is just a wrapper around a type, then the name is choosen
well.
I'm a bit confused why then one needs a data-constructor-like
Miguel Mitrofanov wrote:
There's a third way, too, and I haven't seen anybody mention it yet
I've noticed it, but there are some problems with this representation,
so I decided not to mention it. It's OK as far as we don't want
functions working on two areas - I don't see, how we can
Thomas Hartman wrote:
I found
http://haskell.cs.yale.edu/haskell-report/List.html
had many useful one off type list functions such as subsequences
and permutations which are nowhere to be found in hoogle, Data.List,
or the haskell hierarchical libs
Weird.
It's not very many. Other
Miguel Mitrofanov wrote:
class Shape a where {
intersect :: Shape b = a - b - Bool
}
data Shape a = { intersect :: Shape b = a - b - Bool }
in fact, the syntax is rather similar, too! :)
Um, well, and how are you going to implement it?
Yes, exactly.
My only point is
There
1 - 100 of 408 matches
Mail list logo