Re: [Haskell-cafe] A wish for relaxed layout syntax

2007-03-28 Thread Greg Buchholz
David House wrote: > I see this a lot. My personal preference is: > > mylist = > [ foo, bar, baz, >qux, quux, foo, >bar, baz, qux ] Or, mylist = [foo, bar , baz, qux, quux, foo, bar, baz , qux] ___ Haskell-Cafe m

Re: [Haskell-cafe] A wish for relaxed layout syntax

2007-03-28 Thread Greg Buchholz
Andrzej Jaworski wrote: > Good direction. > Perhaps you can also figure out how to replace the disturbing $ operator? Something out of Unicode? ≬⊳⌁⋆☕⚡‣‸‡⁏•△▴◆◇◊◬◢◮♘♣♲♪◖▻▿轢 Greg Buchholz ___ Haskell-Cafe mailing list Haskel

Re: [Haskell-cafe] IO is not a monad (and seq, and in general _|_)

2007-01-23 Thread Greg Buchholz
strict Functional Programs How to Chase Bottoms, and How to Ignore Them" http://www.cs.chalmers.se/~nad/publications/danielsson-lic.pdf "Total Functional Programming" http://www.jucs.org/jucs_10_7/total_functional_programming/jucs_10_07_0751_0768_turner.pdf Greg Buchholz __

Re: [Haskell-cafe] mapTuple (intersection types?)

2007-01-11 Thread Greg Buchholz
Maybe some of the type experts could pipe up, but couldn't you express that as an intersection type? mapTuple :: ((a -> b) ^ (c -> d)) -> (a,c) -> (b,d) http://www.cs.cmu.edu/~rwh/theses/pierce.pdf Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] why can't you surround (+) in backticks and have it be infix?

2007-01-08 Thread Greg Buchholz
| ' }) conid ->large {small | large | digit | ' } varop ->varsym | `varid ` (variable operator) qvarop ->qvarsym | `qvarid ` (qualified variable operator) conop ->consym | `conid ` (constructor operator) qconop ->gconsym | `qcon

Re: [Haskell-cafe] Seeking advice on a style question

2006-12-29 Thread Greg Buchholz
Conal Elliott wrote: > Warning: I haven't tried to type-check and may have made a clerical error. > Since questionCategories isn't used, use "fst" & eliminate another let. > Then, for my personal preference, and just to mix things up, switch to > "where" style: > > process item mediaKind mediaSize

Re: [Haskell-cafe] Re: Seeking advice on a style question

2006-12-29 Thread Greg Buchholz
Steve Schafer wrote: > > Here's the essence of the problem. If I have this: > > process1 x y = >let u = foo x y; >v = bar u; >w = baz v >in w > > I can easily rewrite it in point-free style: > > process1 = baz . bar . foo Not unless you have a much fancier versio

Re: [Haskell-cafe] multi parameter type classes for NP problems

2006-12-20 Thread Greg Buchholz
Joshua Ball wrote: > Here is how I am trying to solve the problem, using multi-parameter > type classes. > > class NPProblem inst cert where >validates :: cert -> inst -> Bool >certificates :: inst -> [cert] >decide :: inst -> Bool >decide i = any (\x -> x `validates` i) $ certific

Re: [Haskell-cafe] type keeping rounding, typeable (and a difficulty)

2006-11-16 Thread Greg Buchholz
gt; roundCDec :: (RealFloat a) => Int -> Complex a -> Complex a > roundCDec d (c :+ b) = (roundDDec d c :+ roundDDec d b) > > roundDDec :: (RealFloat a) => Int -> a -> a > roundDDec d a = a -- or somegthing Greg Buchholz ___ Haske

Re: [Haskell-cafe] type keeping rounding, typeable (and a difficulty)

2006-11-15 Thread Greg Buchholz
isto wrote: ] I've been trying to compile the following function ] (rounding to a desired degree): ] ] roundDec :: (Num a, Typeable a) => Int -> a -> a ] roundDec d a = ] let t = show (typeOf a) ] in case t of ] "Double" -> roundDDec d a ] "Complex Double"

[Haskell-cafe] (twice head) && (twice tail)

2006-11-11 Thread Greg Buchholz
> instance Twice (forall a. (m a) -> a) (m (m b)) b where > twice f x = f (f x) ...but with ghc-6.6 it chokes with... Illegal polymorphic or qualified type: forall a. m a -> a In the instance declaration for `Twice (forall a.

Re: [Haskell-cafe] Simple GADT parser for the eval example

2006-11-01 Thread Greg Buchholz
`my_read' at gadt_wobbly.hs:65:28-36 Probable fix: add a type signature that fixes these type variable(s) ...problem was fixable by adding a type signature or grafting on some additional type machinery. Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: An example of dependent types [was: Simple GADT parser for the eval example]

2006-11-01 Thread Greg Buchholz
[EMAIL PROTECTED] wrote: > > Greg Buchholz has posed an interesting problem of writing a > typechecker. Given untyped terms of the form ...snip... > We show the solution that uses no GADTs and no representation types. > We retain however the eval function in the previous me

Re: [Haskell-cafe] Simple GADT parser for the eval example

2006-10-31 Thread Greg Buchholz
(does that make any sense?). I'm curious if there could be a small change to the type system to make the fully general "my_read" possible, or if it suffers from an incurable defect. Thanks, Greg Buchholz > {-# OPTIONS -fglasgow-exts #-} > > main

Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Greg Buchholz
differences. > foo :: Int -> Int -> Int -> Int > foo 0 = (+) > > bar :: Int -> Int -> Int -> Int > bar 1 x = succ > > baz :: Int -> Int -> Int -> Int > baz 0 = (+) > baz 1 x = succ Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Greg Buchholz
Rearranging... Nicolas Frisby wrote: > On 10/31/06, Greg Buchholz <[EMAIL PROTECTED]> wrote: > >...That first article is the strangest. I couldn't reconcile the fact > >that if our type signature specifies two arguments, we can pattern > >match on

Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Greg Buchholz
re > build' l x y = build'(x:l) y ...if you try something like... foo :: [a] -> a -> r foo l x y = undefined ...you'll get an error message like... The equation(s) for `foo' have three arguments, but its type `[a] -> a -> r' has only two YMMV

[Haskell-cafe] Simple GADT parser for the eval example

2006-10-30 Thread Greg Buchholz
erm (Int,Bool)) ...but how does a person fix this to work in the more general case? Or is this even the right way to build a parser for the GADT evaluator example? Notice the repetition needed: the "If", "Fst", and "Snd" defintions have to be copied to all thr

Re: [Haskell-cafe] Rank N type tutorial?

2006-10-27 Thread Greg Buchholz
nteger -> (a::Type -> Show a -> a -> b) -> b > > In order for the first case to work as you expect, you'd need the type > > foo :: Integer -> (a::Type, Show a, a) > > which is traditionally written > > foo :: Integer -> (exists a. S

[Haskell-cafe] Rank N type tutorial?

2006-10-27 Thread Greg Buchholz
a => a->b) -> b > bar 2 k = k ["bar"] > bar x k = k x Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] function types as instances of Num

2006-10-26 Thread Greg Buchholz
e you could show me your implementation of "main" and "square" to help nudge me in the right direction. (I'm using ghc-6.6) Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] function types as instances of Num

2006-10-26 Thread Greg Buchholz
In the expression: square . 4 In the definition of `test'': test' = square . 4 ...so it seems that (a -> (Integer, t)) can't be unified with (a -> (Integer, a)), or somesuch. Any thoughts on how to get this to work? Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: (more) type level functions (type of decreasing list)

2006-10-23 Thread Greg Buchholz
[EMAIL PROTECTED] wrote: ] ] One way is to use existentials: ] > data Seq1 a = forall b. (Pre a b, Show b) => Cons1 a (Seq1 b) | Nil1 ] ] which perhaps not entirely satisfactory because we have to specify all ] the needed classes in the definition of Seq1. Yes, that seems pretty burdensom

[Haskell-cafe] Re: type level functions (type of decreasing list)

2006-10-18 Thread Greg Buchholz
hanks everyone, those are interesting solutions! Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Type level functions (type of decreasing list)

2006-10-17 Thread Greg Buchholz
Spencer Janssen wrote: ] Here's an attempt with GADTs: ] ] \begin{code} ] {-# OPTIONS_GHC -fglasgow-exts #-} ] data Succ a ] data Zero ] data Seq a b where ] Cons :: a -> Seq a b -> Seq a (Succ b) ] Nil :: Seq a Zero ] \end{code} ] ] Seems to work for me. Hmm. Maybe I'm missing som

[Haskell-cafe] Type level functions (type of decreasing list)

2006-10-17 Thread Greg Buchholz
: type variable `b'". Of course that makes perfect sense, but I'd like to know if there is a Haskell idiom that I'm missing in order to get this to work. Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] The Q Programming Language can do symbolic manipulation -- Haskell?

2006-08-16 Thread Greg Buchholz
Casey Hawthorne wrote: > > The Q Programming Language can do the following: > > sqr X = X*X > > ==>sqr 5 > 25 > > ==>sqr (X+1) > (X+1)*(X+1) > > Can Haskell do symbolic manipulation? Typeful symbolic differentiation of compiled functions http://www.haskell.org/pipermail/haskell/

[Haskell-cafe] Re: [Haskell] Type-Level Naturals Like Prolog?

2006-07-13 Thread Greg Buchholz
Jared Warren wrote: > Haskell's type checking language is a logical programming language. > The canonical logical language is Prolog. > Why can't Haskell (with extensions) do type-level Peano naturals in > the same fashion? The code would be something like: Also of possible interest, _Fun with F

Re: [Haskell-cafe] lists as instances of a class?

2006-07-10 Thread Greg Buchholz
declare > this instance? Not by the looks of section 4.3.2 of the Haskell Report (at least by my reading). Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Eager Parser Combinators [was: Functional programming for processing of largeraster images]

2006-06-22 Thread Greg Buchholz
erstand monads, I ported the parser combinators from the Hutton and Meijer paper to perl... http://sleepingsquirrel.org/monads/parser/monad_parser.txt Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] Learning C after Haskell

2006-06-12 Thread Greg Buchholz
nly take you so far in a language like C. http://www.gnu.org/software/libc/manual/html_node/Allocation-Debugging.html http://perens.com/FreeSoftware/ElectricFence/ http://valgrind.org/ Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Ca

[Haskell-cafe] Inferred type not most general?

2006-06-09 Thread Greg Buchholz
ral... tmap :: (a -> b, c -> d) -> Twist a c -> Twist b d >data Twist a b = Nil | Cons a (Twist b a) deriving Show > >x = (Cons "foo" (Cons 1 (Cons "bar" (Cons 2 Nil > >tmap :: (a->b,c->d) -> Twist a c -> Twist b d >tmap _ N

Re: [Haskell-cafe] Type class hell

2006-06-08 Thread Greg Buchholz
Brandon Moore wrote: > I don't quite understand the problem, but maybe an example involving an > explicit recursion operator will help. -- Maybe he's looking for something like... {-# OPTIONS -fglasgow-exts #-} {-# OPTIONS -fallow-undecidable-instances #-} import List type Var = String type Co

Re: [Haskell-cafe] Type class hell

2006-06-08 Thread Greg Buchholz
Christophe Poucet wrote: > I'm not certain but I think this will still fail for exactly the piece that > you ignored, which is the crux of the problem. -- You're not looking for this solution, right? import List type Var = String type Const = String data MonoType mt = TyVar Var

Re: [Haskell-cafe] Type class hell

2006-06-08 Thread Greg Buchholz
Christophe Poucet wrote: > The idea however is that MonoType is going to be used in a recursive > way. For instance: > > newtype FMT = FMT MonoType FMT > > instance FMT where... Er, I'll ignore this part. > > And this definition will have to reside on recursive definitions. In the > style

Re: [Haskell-cafe] Type class hell

2006-06-07 Thread Greg Buchholz
Christophe Poucet wrote: > What I would like to do is combine HasVars and Type (mostly because in my > framework the two concepts shouldn't be divided from a design perspective) > into one type class to clean it up a bit. However I fail to see how I would > implement toType and fromType for the giv

Re: [Haskell-cafe] Tips for converting Prolog to typeclasses?

2006-06-01 Thread Greg Buchholz
Robert Dockins wrote: ] In the second instance, what you really want to say is "instance c [a] ] c, only where c is not an application of (->)". As I recall, there is ] a way to express such type equality/unequality using typeclasses, but ] I don't remember how to do it offhand. For those pla

Re: [Haskell-cafe] Tips for converting Prolog to typeclasses?

2006-06-01 Thread Greg Buchholz
g when applied to a list of Int's. So in Prolog... :- op(1000,xfy,=>). app(A=>B,[A],C) :- app(B,[A],C). app(C,[A],C) :- not(isfuncwithhead(C,A)). isfuncwithhead(A=>B,A). ...Now I just need to figure out how to represent "not" without "cut". I'll ta

[Haskell-cafe] Tips for converting Prolog to typeclasses?

2006-05-31 Thread Greg Buchholz
d where to enable these extentions. (Bonus points awarded if it explains things in terms of Prolog). Or is this just one of those things that requires reading lots of papers on each extentsion and possibly the source code of the implementation? Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

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

2006-05-30 Thread Greg Buchholz
Aditya Siram wrote: ] I am trying to write a function 'applyArguments' which takes a ] function and a list and recursively uses element each in the list as ] an argument to the function. I want to do this for any function taking ] any number of arguments. ] ] applyArgument f (arg) = f arg ] applyA

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

2006-05-19 Thread Greg Buchholz
Greg Buchholz wrote: > instance Apply a b c => Apply (a->b) b (a,c) where Whoops, instead of that, I think I meant... instance Apply (b->c) c d => Apply (a->b->c) (b->c) (a,d) where ...where we strip off one layer of types, because of the recursion. Of course, that s

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

2006-05-19 Thread Greg Buchholz
, b, and (a,c) are > -- also a member, so keep going... > instance Apply a b c => Apply (a->b) b (a,c) where > app f (x,rest) = app (f x) rest > > g w x y z = w*x + y*z > args = (1,(2,(3,(4,Nil > > main = print $ app g args Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Partial Derivatives

2006-05-08 Thread Greg Buchholz
Gerhard Navratil wrote: > I need a library that provides partial derivatives for functions. The > solution I came up with is based on a datatype using reversed polish > notation to store the function: I like Oleg Kiselyov's "Typeful symbolic differentiation of compiled functions"... http:

Re: [Haskell-cafe] "show" for functional types

2006-03-31 Thread Greg Buchholz
uot;y" > > main = do print (f y) > print (g y) ...which results in... *Main> main (Var "y")+(Const (2.0)) (Var "y")+(Const (1.0))+(Const (1.0)) ...is this competely unrelated? Thanks, Greg Buchholz

Re: [Haskell-cafe] "show" for functional types

2006-03-31 Thread Greg Buchholz
ly > transparent. OK. I'm probably being really dense today, but where did "g" come from? Is this is the internal definition of "not"? And does this loss of referential transparency contaminate the rest of the language, or is this superShow just an anomaly? Thank

[Haskell-cafe] "show" for functional types

2006-03-31 Thread Greg Buchholz
...I guess I'm not understanding what that means. Would there be some sort of contradiction that arises when trying to evaluate "show (show)" or somesuch? Can anyone point me in the direction of information that tries to explain why this is? I'm at a loss as to what search

Re: [Haskell-cafe] Eval of a syntax tree for reduction

2006-03-27 Thread Greg Buchholz
al1_ (TmIfExpr t1 t2 t3) = liftM3 TmIfExpr (eval1_ t1) (return t2) (return > t3) ...and if it turns out you don't like the resulting "Maybeified" program, you can get the original functionality back by changing the type signature to use the Identity monad instead of Maybe. Greg

Re: [Haskell-cafe] multiple computations, same input

2006-03-27 Thread Greg Buchholz
and lazy evaluation. Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] multiple computations, same input

2006-03-27 Thread Greg Buchholz
os -- f lst = show (filter (> 1) lst, filter (> 2) lst) para_filter_sum f g xs = foldl' (\(n,m) elem -> seq n $ seq m $ (n+if f elem then elem else 0, m+if g elem then elem else 0 ) ) (0,0) xs Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Deepest functor [was: fmap for lists of lists of lists of ...]

2006-03-15 Thread Greg Buchholz
fmappable things. Excellent. I guess I'll be brushing up on my typeclass-fu in order to figure out how all this works. Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Deepest functor [was: fmap for lists of lists of lists of ...]

2006-03-15 Thread Greg Buchholz
fmappable things. Excellent. I guess I'll be brushing up on my typeclass-fu in order to figure out how all this works. Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] fmap for lists of lists of lists of ...

2006-03-14 Thread Greg Buchholz
f b > >instance Funct [] where >f_map = map > >instance Funct a => Funct [a] where >f_map f = map (f_map f) > >main = print $ fmap (+1) [[[1,2,3]]] ...but maybe it gets the idea across? Thanks, Greg Buchholz __

Re: [Haskell-cafe] Haskell Speed

2005-12-23 Thread Greg Buchholz
rge.net/ > And many of the algorithms that you are required to use are a very > poor match for haskell. True. But there are some tests like "fasta" that appear to have a laziness induced space leak that presumably could be fixed. http://

Re: [Haskell-cafe] Statements spanning multiple lines?

2005-12-22 Thread Greg Buchholz
You might also like to try the slightly more efficient... pyth n = [(a,b,c) | a <- [1..n], b <- [a..n], c <- [a+1..n], a*a + b*b == c*c ] Greg Buchholz ___ Has

Re: [Haskell-cafe] Statements spanning multiple lines?

2005-12-22 Thread Greg Buchholz
= c*c ] ...or... pythagoras n = [(a,b,c) | a <- [1..n], b <- [1..n], c <- [1..n], a <= b, b < c, a*a + b*b == c*c ] ...See also... http://www.haskell.org/onlinereport/lexemes.html#lexemes-layout Greg Buchholz _

Re: [Haskell-cafe] Help with division

2005-12-19 Thread Greg Buchholz
Daniel Carrera wrote: > > Playing around with Haskell... I'm writing a 'choose' function: > --//-- > fac :: Int -> Int > fac 0 = 1 > fac n = n*fac(n-1) > > choose :: Int -> Int -> Int > choose n k = fac(n) / (fac(k) * fac(n-k)) > --//-- > > I'm having problems with the last line. > Integral

Re: [Haskell-cafe] Existentially-quantified constructors, Eq and Show

2005-12-07 Thread Greg Buchholz
Start | Stop | State a deriving (Show, Eq) ...Does it give better error messages at compile time or something? Thanks, Greg Buchholz ___ Haskell-Cafe mailing

Re: [Haskell-cafe] Can't Haskell catch up with Clean's uniqueness typing?

2005-12-07 Thread Greg Buchholz
ster executables than existing Haskell compilers? " Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Type classes and hFoldr from HList

2005-11-07 Thread Greg Buchholz
Ralf Lammel wrote: > > What you can do is define a dedicated *type code* for composition. > > comp = hFoldr (undefined::Comp) (id::Int -> Int) test > > data Comp > > instance Apply Comp (x -> y,y -> z) (x -> z) > where > apply _ (f,g) = g . f

[Haskell-cafe] Type classes and hFoldr from HList

2005-11-06 Thread Greg Buchholz
27;: comp = hFoldr (.) id test ...Anyway, I couldn't quite tell whether I was using hFoldr incorrectly, or if I needed to have more constraints placed on the construction of "test", or if needed some sort of type-level function that resolves... Apply ((b -> c) -> (a -> b)

[Haskell-cafe] Working inside the fold

2005-10-06 Thread Greg Buchholz
> c ([4,16,36,64,100,144,196,256,324],(1140,34519618525593600)) ...So a few generic munging functions can be defined for inside the fold. I couldn't think of how to define "take" or "drop" or figure out what a zipWith would mea

Re: [Haskell] Re: [Haskell-cafe] Haskell versus Lisp

2005-09-20 Thread Greg Buchholz
com/search?&q=backtracking+monad Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Trapped by the Monads

2005-09-20 Thread Greg Buchholz
hat if we had a name for this implicit composition operation? We could then modify it to do a whole host of other things with the functions "f" and "g" besides just the boring old composition (like maybe skipping the execution of "g" if "f" fails, or all

Re: [Haskell-cafe] How to use STArray?

2005-08-25 Thread Greg Buchholz
is used in a single-threaded style, i.e. after // application the old version is no longer used, a'!'i takes O(1) time and a // d takes O(length d). Accessing elements of older versions gradually becomes slower. Greg Buchholz ___ Haskell-Caf

Re: [Haskell-cafe] Practical introduction to monads

2005-08-02 Thread Greg Buchholz
.uk/wadler/topics/monads.html ...especially _Monads for functional programming_ and _Imperative functional programming_. Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Lists vs. Monads

2005-07-15 Thread Greg Buchholz
are cold blooded. It doesn't get at the essence of what it means to be an insect. Compare with a statment like... B.) Insects are six-legged animals with an exoskeleton. ...which tells us a lot more about the fundamental nature of insects. Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] resolving missing class instances @ compile time

2005-05-12 Thread Greg Buchholz
ompiler? No. I've never written a Haskell compiler, but I'd say it sounds like it might be a tedious book-keeping problem though. Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] resolving missing class instances @ compile time

2005-05-12 Thread Greg Buchholz
or "foo" since we know the type of "foo" from its arguments and return value (it passed the type checker after all). Confused, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] resolving missing class instances @ compile time

2005-05-12 Thread Greg Buchholz
theoretical reason it can't be done? Is it more convienient for compiler/specification writers this way? Is it just because that's the way its always been done? Curious, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org ht

Re: [Haskell-cafe] resolving missing class instances @ compile time

2005-05-12 Thread Greg Buchholz
this behavior more desirable than failing with an error at compile time? Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Squashing space leaks

2005-05-08 Thread Greg Buchholz
should one use a more sophisticated algorithm? The change in energy is from round-off error caused by floating point arithmetic. For this particular test, the shootout requires everyone to use the same algorithm. So the error is expected. Greg Buchholz __

Re: [Haskell-cafe] Squashing space leaks

2005-05-06 Thread Greg Buchholz
ere's my code. It's not beautiful but it solves the space > problem. I hope I got it right this time :) Alright, looks good. I've incorporated this latest change. You can see the code... http://xrl.us/fzn4 Greg Buchholz ___ Haskel

Re: [Haskell-cafe] Squashing space leaks

2005-05-06 Thread Greg Buchholz
be the source of the space leak). You can see one profile I ran (for n=1000 instead of 100) at... http://sleepingsquirrel.org/nbody/nbody.prof Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Squashing space leaks

2005-05-05 Thread Greg Buchholz
Lennart Augustsson wrote: > Have you tried heap profiling? > Not on the updated version from Josef Svenningsson, but you can look at the heap profiles for the previous version at... http://sleepingsquirrel.org/nbody ...the *.ps files are the ones you want. Greg Bu

Re: [Haskell-cafe] Squashing space leaks

2005-05-05 Thread Greg Buchholz
we'll be in good shape. Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Squashing space leaks

2005-05-05 Thread Greg Buchholz
n see the reports I generated (like the biography report) over at <http://sleepingsquirrel.org/nbody>. I've tried several different variations on the "advance" function, as well as trying "seq" in numerous spots, but I haven't stumbled on to the right combination yet

[Haskell-cafe] resolving missing class instances @ compile time

2005-05-04 Thread Greg Buchholz
got a run time exception. Which surprised me a little, since it seems like it could have been caught at compile time. (Although I did ignore a warning). This has probably been answered a thousand times, but could someone point me in the direction of documentation explaining why it compiled

Re: [Haskell-cafe] Re: Speed comparison?

2005-05-04 Thread Greg Buchholz
s C code generated by OCaml? > Do you want to retarget ti so that Haskell is generated, or rewrite the > generator in Haskell? (Or both?) Maybe not completely related, but you might find this paper interesting... http://lambda-the-ultimate

Re: [Haskell-cafe] Writing functions in Haskell.

2005-04-29 Thread Greg Buchholz
Daniel Carrera wrote: > Alright, I have what I believe must be a simple question. As one of the > exercises for the Haskell tutorial I got I have to implement an > alternative to the 'map' function. > > This is what I have: > > - > my/prompt $ cat Test.hs > module Te

Re: [Haskell-cafe] How to speed things up

2005-04-28 Thread Greg Buchholz
Dmitry Vyal wrote: > By the way, how to use Unboxed arrays and unsafeAccumArray Greg Buchholz > mentioned? I can't find them in GHC 6.2 documentation. http://www.haskell.org/~simonmar/haddock-example/Data.Array.Base.html Greg Buchholz

Re: [Haskell-cafe] How to speed things up

2005-04-28 Thread Greg Buchholz
Greg Buchholz wrote: > You'd probably get a faster program with Unboxed arrays and > unsafeAccumArray. > Yeah, its about 20x faster unboxed and unsafe... import Data.Array.Base main = print $ quick_func $ take 100 $ cycle [1,2,3,1,2,9,1,9] quick_func :: [Int

Re: [Haskell-cafe] How to speed things up

2005-04-28 Thread Greg Buchholz
Dmitry Vyal wrote: > Hello everybody. > > I have a long list consisted of a small number (about a dozen) of > elements repeating in random pattern. I know all the possible elements. > I need to count number of occurences of each particular element and to > do i quickly. > >For example > qui

Re: [Haskell-cafe] do statement

2005-04-26 Thread Greg Buchholz
o I/O. http://www.cs.uu.nl/~daan/download/parsec/parsec.html Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Linux device drivers

2005-03-20 Thread Greg Buchholz
one have any thoughts? You might be interested in hOp: "hOp is a micro-kernel based on the RTS of GHC. It is meant to enable people to experiment with writing device drivers in Haskell." http://www.macs.hw.ac.uk/~sebc/hOp/ or maybe House... http://

Re: [Haskell-cafe] Joy Combinators (Occurs check: infinite type)

2005-03-11 Thread Greg Buchholz
Keean Schupke wrote: > The things to notice are using types as instance labels, that constraints > form horn clause compile time meta-programs (in a non-backtracking prolog > style) and that multi-parameter classes with functional depandencies simulate > some dependant types. > I think I unde

Re: [Haskell-cafe] Joy Combinators (Occurs check: infinite type)

2005-03-09 Thread Greg Buchholz
askell (which would imply it was possible to statically type). Well, it wasn't quite as direct as I had initially thought, but it looks like you've done it. Are there any papers/books out there which I could study to learn more about these (and other) tricks of the type system wizards?

Re: [Haskell-cafe] Joy Combinators (Occurs check: infinite type)

2005-03-09 Thread Greg Buchholz
Keean Schupke wrote: > Haskell is not dependantly typed, so cannot deal with types that "depend" on > values. Can anyone recommend a nice dependently typed language to play with? Cayenne, Epigram, other? Greg Buchholz ___ Hask

Re: [Haskell-cafe] Joy Combinators (Occurs check: infinite type)

2005-03-08 Thread Greg Buchholz
ts, GhcSyntax, CommonMain, Datatypes2, Variant, TIC, TIP, HTypeIndexed, GhcRecord, Record, HZip, HOccurs, HArray, HListPrelude, FakePrelude. Looks to me like a very similar error to the tuple case. Greg Buchholz --Joy combinators in Haskell {-# OPTIONS -fglasgow-exts #-} {-# OPTIONS -fallo

Re: [Haskell-cafe] Joy Combinators (Occurs check: infinite type)

2005-03-07 Thread Greg Buchholz
-checker knows that 'fact' is > polymorphic and that it's perfectly all right to instantiate it at a > different type in the recursive call. That pretty much sums up why I thought the whole crazy scheme might work, only in better words. Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Joy Combinators (Occurs check: infinite type)

2005-03-07 Thread Greg Buchholz
Daniel Fischer wrote: > Am Freitag, 4. M?rz 2005 19:35 schrieb Greg Buchholz: > > So, can anyone direct me towards more information on exactly > > what an "Occurs check" is, or does anyone see an easy fix to my > > problems? > > If I remember correctly, an

[Haskell-cafe] Joy Combinators (Occurs check: infinite type)

2005-03-04 Thread Greg Buchholz
an "Occurs check". So, can anyone direct me towards more information on exactly what an "Occurs check" is, or does anyone see an easy fix to my problems? Thanks, Greg Buchholz P.S. The first thing you should note about the code below is the definition of the reverse

Re: [Haskell-cafe] Reading images (PGM)

2005-01-20 Thread Greg Buchholz
e portrable greymap (PGM) file format. You read in a simple header with the dimensions of the image, and one 8 bit character per pixel. http://www-info2.informatik.uni-wuerzburg.de/mitarbeiter/wolfram/lehre/bildformate.html Greg Buchholz ___ Haskel

Re: [Haskell-cafe] Parsec and type (IO t) error

2005-01-13 Thread Greg Buchholz
Mike Gunter wrote: > > I'd guess that > let (cam, sh) = parse_text shape_parse input > is what you want? (Completely untested ...) > Yep. That did it. Thanks, Greg Buchholz ___ Haskell-Cafe mailing list Haskell-C

[Haskell-cafe] Parsec and type (IO t) error

2005-01-13 Thread Greg Buchholz
against `(Camera, [Shape])' Expected type: GenParser Char () (IO t) Inferred type: GenParser Char () (Camera, [Shape]) In the first argument of `parse_text', namely `shape_parse' In a 'do' expression: (cam, sh) <- parse_text shape_parse in

Re: [Haskell-cafe] Building GUIs for Haskell programs

2005-01-12 Thread Greg Buchholz
ed in wxFruit... http://zoo.cs.yale.edu/classes/cs490/03-04b/bartholomew.robinson/ ...although still a research project, it takes a more functional approach to GUI's. Greg Buchholz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.o

Re: [Haskell-cafe] Some random newbie questions

2005-01-06 Thread Greg Buchholz
pt file, since I don't have SOEGraphics). Hugs chokes without increasing the stack, while my copy of GHC 6.2.1 runs the program below quite fine, even without enabling optimizations. Greg Buchholz --Floating point PostScript version of Sierpinkski Carpet fillSquare x y s = putStr $ x1 +

Re: [Haskell-cafe] Non-technical Haskell question

2004-12-03 Thread Greg Buchholz
ts of _Programming_Perl_ (camel) and _Perl_Cookbook_ (ram)? I suppose I should stop being lazy and contribute to the Haskell version of the PLEAC project... http://pleac.sourceforge.net/ Greg Buchholz ___ Haskell-Cafe mailing list [EMAIL PROTECTED

Re: [Haskell-cafe] Re: Processing of large files

2004-11-01 Thread Greg Buchholz
The paper elaborates that enumerators are superior: in efficiency; in ease of programming; in more predictable resource utilization and avoidance of resource leaks. We present a design of the overall optimal collection traversal interface, which is based on a left-fold-like combinator with premature term

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootout results

2004-10-11 Thread Greg Buchholz
he "Sum a Column of Integers" and "Spell Checker" would be good candidates to convert). Just for reference, here's a list of the "Same Thing" tests: Simple TCP/IP Server Matrix Multiplication Statistical Moments Process Instantiation Reverse A File Ring of Messag

[Haskell-cafe] Purely Functional Data Structures [was: OCaml list sees abysmal...]

2004-10-10 Thread Greg Buchholz
Robert Dockins wrote: > BTW can you give some references to these known techniques? See also, "Purely Functional Data Structures" by Chris Okasaki for functional implementations of queues, dequeues, etc. www-2.cs.cmu.edu/~rwh/theses/okasaki.pdf

  1   2   >