[Haskell-cafe] Engineering position at Vector Fabrics

2013-07-10 Thread Stefan Holdermans
Vector Fabrics has another position open for a functional programmer. See below and http://www.vectorfabrics.com/company/career/functional_programmer for details. This time, we particularly welcome applications from experienced developers, the position providing a fair share of opportunities

[Haskell-cafe] Wiki spam

2013-06-11 Thread Stefan Holdermans
Hi all, The last days, some spam was added to the GHC developer wiki (http://hackage.haskell.org/trac/ghc) . I have removed some of it, but I could not get rid of the bits that were added through attachments; see for example the bottom of http://hackage.haskell.org/trac/ghc/wiki/Building.

[Haskell-cafe] Vector Fabrics is hiring!

2013-04-07 Thread Stefan Holdermans
[Apologies for multiple postings.] Vector Fabrics is hiring: we are looking for a top-notch programmer to extend our program-analysis and parallelization products. You design and implement algorithms to assist the programmer to create a parallel design from a sequential C or C++ program. You

[Haskell-cafe] Erroneous interaction between DataKinds and ExistentialQuantification?

2012-10-17 Thread Stefan Holdermans
I am almost sure this is a known issue, but I noticed some erroneous (?) interaction between datatype promotion and existential quantification. Consider the following program: {-# LANGUAGE DataKinds #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE GADTs

Re: [Haskell-cafe] Annotations in abstract syntax tree

2012-04-27 Thread Stefan Holdermans
Romildo, How should an instance of (Functor ExprF) be defined? It is not shown in the thesis. It's actually quite straigtforward: instance Functor ExprF where fmap _ (Num n) = Num n fmap _ (Var x) = Var x fmap f (Bin op l r) = Bin op (f l) (f r) As expected you get:

Re: [Haskell-cafe] Annotations in abstract syntax tree

2012-04-27 Thread Stefan Holdermans
Romildo, I could write the (Functor ExprF) instance: instance Functor ExprF where fmap f expr = case expr of Num n - Num n Var v - Var v Bin op x y - Bin op (f x) (f y) Yes, excellent. That'll do. Cheers, Stefan

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-25 Thread Stefan Holdermans
Wren, Sjoerd, This is not just about map, but it also a problem for the Monoid instance. You are basically adding an extra identity element, 0, to the max monoid, which works but is weird. Still that's how union is typically defined for hybrid sets. It's what happens if want union and

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-25 Thread Stefan Holdermans
Sjoerd, I am sorry, as I already wrote, I decided to deprecate the package. [3] defines the union as h(u) = max(f(u), g(u)) where f, g and h are multiplicity functions. Which is the same, as [3] is about multisets, not signed multisets. [...] and this is also what your implementation does.

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-25 Thread Stefan Holdermans
Sjoerd, [3] defines the union as h(u) = max(f(u), g(u)) where f, g and h are multiplicity functions. Which is the same, as [3] is about multisets, not signed multisets. Chapter 3 of [3] is about Hybrid Sets. And there the union is defined by taking the *minimum* of multiplicities, which

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-24 Thread Stefan Holdermans
Sjoerd, I have a hard time believing you have implemented the semantics that people have agreed on to be a sensible semantics for hybrid sets. Noted. Cheers, Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-23 Thread Stefan Holdermans
Sjoerd, For a specific example, I haven't the faintest intuition about what 'map' should do. Suppose we have {(k1)x1, (k2)x2} and f x1 == f x2 = y. Should the value of map f {...} be {(k1+k2)y} or {(k1`max`k2)y} or what? I don't think max would be a good choice, as that would mean

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-23 Thread Stefan Holdermans
Sjoerd, This is not just about map, but it also a problem for the Monoid instance. You are basically adding an extra identity element, 0, to the max monoid, which works but is weird. Still that's how union is typically defined for hybrid sets. It's what happens if want union and empty to

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-23 Thread Stefan Holdermans
Sjoerd, This is not just about map, but it also a problem for the Monoid instance. You are basically adding an extra identity element, 0, to the max monoid, which works but is weird. Still that's how union is typically defined for hybrid sets. It's what happens if want union and empty to

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-23 Thread Stefan Holdermans
Sjoerd, Then why would you want that? You don't have to. (SignedMultiset a, additiveUnion, empty) gives you the Monoid that you seem to have a preference for. The library supplies it through the Additive wrapper. The point is that you have a choice: different applications may ask for

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-20 Thread Stefan Holdermans
Richard, Thanks for your excellent feedback! Very helpful! Signed multisets are unfamiliar to most of us, and I for one found the paper a little fast-paced. Can you put a bit more into the documentation? Definitely. That's what weekends are for... :) I'll add some sections to the

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-20 Thread Stefan Holdermans
Wren, For a specific example, I haven't the faintest intuition about what 'map' should do. Suppose we have {(k1)x1, (k2)x2} and f x1 == f x2 = y. Should the value of map f {...} be {(k1+k2)y} or {(k1`max`k2)y} or what? Good question. I'd suppose that they should be parametrized by

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-19 Thread Stefan Holdermans
Release early, release often. Here's a second version: http://hackage.haskell.org/package/signed-multiset-0.2 Changes: * Added the functions Data.SignedMultiset.isPositive and Data.SignedMultiset.isNegative, which return whether all elements in a signed multiset have respectively

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-19 Thread Stefan Holdermans
Jacques, In the literature, we have found [1] that these are sometimes also called 'hybrid sets'. They also go by the name of 'shadow sets', which also has a cool ring to it. ;) PS: the Haddock did not work for 0.2, but did for 0.1, you might want to look into that. As I just uploaded

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-18 Thread Stefan Holdermans
Ivan, This package provides an efficient implementation of so-called signed multisets, which generalise multisets by allowing for negative membership. That is, elements in a signed multiset can have negative multiplicities. Wait, something can be not in the multiset more than once? :o

Re: [Haskell-cafe] ANN: signed-multiset-0.1

2012-04-18 Thread Stefan Holdermans
Johannes, This package provides an efficient implementation of so-called signed multisets, which generalise multisets by allowing for negative membership. SignedMultiset a = Data.Map.Map a Integer Indeed. so what do I gain by using your library? (what is the API difference?) The library

[Haskell-cafe] ANN: signed-multiset-0.1

2012-04-17 Thread Stefan Holdermans
I am pleased to announce the first release of signed-multiset, which implements an abstract datatype for multisets with negative membership. The package can be obtained from http://hackage.haskell.org/package/signed-multiset-0.1 As always, feedback is welcome. Cheers, Stefan

Re: [Haskell-cafe] minor refactoring problem

2011-11-29 Thread Stefan Holdermans
Martin, importFile :: Editor - String - IO () importFile ed path = do s - readFile path ps - mapM (\x - makePair (x, )) (lines s) es - return $ V.fromList ps writeIORef ed es loadFile :: Editor - String - IO () loadFile ed path = do s - readFile path ps - mapM makePair

Re: [Haskell-cafe] minor refactoring problem

2011-11-29 Thread Stefan Holdermans
Martin, (The trick with `flip` is tempting, but again at the cost of having to peer rather too closely at the implementation of processFile when reading the code). That trick is of course completely orthogonal. One could just as well write: processFile :: (String - [a]) - (a - (String,

Re: [Haskell-cafe] minor refactoring problem

2011-11-29 Thread Stefan Holdermans
Martin, Quick question: what's the difference between importFile ed = readfile = fromRawFile = setEditor ed and importFile = readfile = fromRawFile = setEditor that the former compiles but the latter doesn't? Note that, in Haskell, function application has higher priority then any

Re: [Haskell-cafe] What's the motivation for η rules?

2011-01-03 Thread Stefan Holdermans
David, Conor wrote: But the news is not all bad. It is possible to add some eta-rules without breaking the Geuvers property (for functions it's ok; for pairs and unit it's ok if you make their patterns irrefutable). Note that, in Haskell, for functions it's only ok if you leave seq and the

Re: [Haskell-cafe] Lambda Calculus: Bound and Free formal definitions

2010-12-29 Thread Stefan Holdermans
Mark, Whether a variable is bound or free depends on the scope under consideration. In (\x. x) (\y. x) the variable x is bound in \x. x, but free in \y. x; hence, it's free in (\x. x) (\y. x) as a whole. However, in \x. (\x. x) (\y. x) it's bound... HTH, Stefan

Re: [Haskell-cafe] Ordering vs. Order

2010-10-07 Thread Stefan Holdermans
Chris, I'm not a native English speaker and recently I was wondering about the two words order and ordering (the main reason why I write this to the Haskell mailing list, is that the type class Ordering does exist). Irrelevant to your struggle, but note that the *type class* is dubbed Ord,

Re: [Haskell-cafe] Re: Monad instance for partially applied type constructor?

2010-09-29 Thread Stefan Holdermans
David, Ryan Ingram wrote: Haskell doesn't have true type functions; what you are really saying is instance Monad (\v - Vect k (Monomial v)) Daniel Fischer wrote: I think there was a theoretical reason why that isn't allowed (making type inference undecidable? I don't remember, I don't

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Stefan Holdermans
Wolfgang, We should definitely get rid of these Is* class identifiers like IsString and IsList. We also don’t have IsNum, IsMonad, etc. I see your point. For strings, however, there was of course never the possibility to dub the class String as that name is already taken by the type synonym.

Re: Re[2]: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Stefan Holdermans
Bulat, btw, i also had proposal to automatically convert typeclasses used in type declarations into constraints, [...] Together with proposals i mentioned previously, it will allow to treat existing code dealing with lists/strings as generic code working with any sequential container type

Re: [Haskell-cafe] Re: (kein Betreff)

2010-08-03 Thread Stefan Holdermans
Janis, So, basically, we are annotating function types, what is IIRC exactly what Janis and David are doing. (I hope Janis corrects me if I'm wrong here). Wrong only in that David's name is Daniel. :-) Ah, I am terribly sorry. I just shouldn't type e-mails after having no more than a

Re: [Haskell-cafe] Re: Laziness question

2010-08-03 Thread Stefan Holdermans
Nicolas, OK, I better understand now where we disagree. You want to see in the type whether or not the free theorem apply, I want them to always apply when no call to unsafe function is made. Implementing your suggestion would make me feel uncomfortable. Turning seq into an unsafe operations

Re: [Haskell-cafe] Laziness question

2010-08-02 Thread Stefan Holdermans
types in Eval would indeed make parametricity less of an issue, but I do not quite agree that the cases in which one may need seq on values of function type are insignificant. Cheers, Stefan [*] Stefan Holdermans and Jurriaan Hage. Making “stricterness” more relevant. In John P. Gallagher

Re: [Haskell-cafe] Re: Laziness question

2010-08-02 Thread Stefan Holdermans
Brandon, Hm. Seems to me that (with TypeFamilies and FlexibleContexts) h :: (x ~ y, Eval (y - Int)) = (x - Int) - (y - Int) - Int should do that, but ghci is telling me it isn't (substituting Eq for Eval for the nonce): Prelude let h :: (x ~ y, Eq (y - Int)) = (x - Int) - (y - Int) -

Re: [Haskell-cafe] Re: Laziness question

2010-08-02 Thread Stefan Holdermans
Brandon, h :: (x ~ y, Eval (y - Int)) = (x - Int) - (y - Int) - Int But actually if you push the constraint inward, into the type so to say, you actually get quite close to Janis' and David's solution. Sorry, I was thinking out loud there. I meant the Eval constraint, not the equality

Re: [Haskell-cafe] Re: Laziness question

2010-08-02 Thread Stefan Holdermans
Brandon, Sorry, I was thinking out loud there. I meant the Eval constraint, not the equality constraint. But, right now, I guess my comment only makes sense to me, so let's pretend I kept quiet. ;-) The point of this discussion is that the Eval constraint needs to be on one of the

Re: [Haskell-cafe] Laziness question

2010-08-01 Thread Stefan Holdermans
Nicolas, I would deeply in favor of renaming seq to unsafeSeq, and introduce a type class to reintroduce seq in a disciplined way. There is a well-documented [1] trade-off here: Often, calls to seq are introduced late in a developing cycle; typically after you have discovered a space leak

Re: [Haskell-cafe] Can we come out of a monad?

2010-07-30 Thread Stefan Holdermans
Jason, There is one case where you can break out of a monad without knowing which monad it is. Well, kind of. It's cheating in a way because it does force the use of the Identity monad. Even if it's cheating, it's still very clever and interesting. How is this cheating? Or better, how

Re: [Haskell-cafe] Can we come out of a monad?

2010-07-30 Thread Stefan Holdermans
Martijn, In fact, I would argue that a monad which you cannot escape from is not very useful at all. IO is the only exception I know of. And that's only because, at least the runtime system allows for execution of a computation inside the IO monad at top-level. Cheers, Stefan

Re: [Haskell-cafe] Can we come out of a monad?

2010-07-30 Thread Stefan Holdermans
Alexey, There is one case where you can break out of a monad without knowing which monad it is. Well, kind of. It's cheating in a way because it does force the use of the Identity monad. Even if it's cheating, it's still very clever and interesting. How is this cheating? Or better, how

Re: [Haskell-cafe] what does the '~' mean ?

2010-04-16 Thread Stefan Holdermans
Ivan, in `size` function, what does the `~` mean ? A lazy pattern match: http://en.wikibooks.org/wiki/Haskell/Laziness (there is a better name for it, but I can't remember). Irrefutable pattern? ;-) Cheers, Stefan ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Re: Generating repeatable arbitrary values with QuickCheck 2

2010-02-05 Thread Stefan Holdermans
Martijn, Ryan wrote: Unfortunately, this makes things like infinite_xs - sequence (repeat arbitrary) no longer work, since the state never comes out the other side. You replied: You're asking to execute an infinite number of monadic actions. How can this ever terminate at all? There

Re: [Haskell-cafe] semantics of type synonym

2009-12-29 Thread Stefan Holdermans
Patrick, It seems that I need to distinguish between a theory for Haskell and a given implementation (GHCi). What do you mean by this? Obviously I get two different types Wrong. You get exactly the same type, it's just that GHCi detected that you have a fancy name for this type, so it

Re: [Haskell-cafe] semantics of type synonym

2009-12-29 Thread Stefan Holdermans
Dear Patrick, From the responses to my query, it seems that I cannot rely totally on the compiler for my research question which is concerned with the meaning of Haskell constructs I will have to consult the Haskell Report. For both practical and theoretical matters, GHC provides a very

Re: [Haskell-cafe] (liftM join .) . mapM

2009-12-29 Thread Stefan Holdermans
Stephen, oo f g = (f .) . g ooo f g = ((f .) .) . g Why are these also called blackbird and bunting? Thanks, Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Nano-Languages

2009-12-09 Thread Stefan Holdermans
John, It might be better to go about it in a fashion similar to how one would use Haskell to create a new language using Happy, but instead of making a full fledged language create a language that makes only minor adjustments to the official language where most of the original source

Re: [Haskell-cafe] What is the rank of a polymorphic type?

2009-12-05 Thread Stefan Holdermans
Eugene, Consider the type: (forall a . a) - String. It's of rank 2. What is the definition of rank of a polymorphic type? The minimal rank of a type is given by rank (forall a. t) = 1 `max` rank t rank (t - u) = (if rank t == 0 then 0 else rank t + 1) `max` rank u rank _

Re: [Haskell-cafe] What is the rank of a polymorphic type?

2009-12-05 Thread Stefan Holdermans
Eugene, 1) Does there exist an authoritative source saying the same? Not that I'm doubting, just supposing that the source would have other interesting information, too :) You may want to have a look at the already mentioned JFP-article by Peyton Jones et al. and perhaps the work of Kfoury

Re: [Haskell-cafe] Is Haskell a Fanatic?

2009-12-03 Thread Stefan Holdermans
John, Miguel (and others), Don Stewart wrote, the guarantees of purity the type system provides are extremely useful for verification purposes. My response to this is in theory. This is what caught my attention initially, but the language lacks polish and does not appear to be going in a

Re: [Haskell-cafe] Is Haskell a Fanatic?

2009-12-03 Thread Stefan Holdermans
To feed, or not to feed: that is the question: Whether 'tis nobler in the mind to suffer The quips and ramblings of outrageous trolling, Or to take arms against a sea of nonsense, And by opposing end them? Brilliant. Just brilliant. +1 Cheers, Stefan

Re: [Haskell-cafe] Is Haskell a Fanatic?

2009-12-03 Thread Stefan Holdermans
So long as we bastardize the bard, we best bastardize him fully! :) If only we could claim: Though this be madness, yet there is method in 't. Cheers, Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] university courses on type families/GADTs?

2009-12-01 Thread Stefan Holdermans
Tom, I was wondering whether there are any universities that teach about Haskell type families or GADTs? I'm quite sure at least GADTs are covered in INFOMAFP, the graduate course on Advanced Functional Programming at UU: http://www.cs.uu.nl/docs/vakken/afp Cheers, Stefan

Re: [Haskell-cafe] bit of help with n-ary please...

2009-11-08 Thread Stefan Holdermans
Answers to spec. You didn't answered the homework question: I don't know if this is homework. I'm a bit suspicious: http://www.dcs.shef.ac.uk/intranet/teaching/modules/level2/com2010.html . See http://www.haskell.org/haskellwiki/Homework_help . Cheers, Stefan

Re: [Haskell-cafe] bit of help with n-ary please...

2009-11-08 Thread Stefan Holdermans
Luke, This is the typical bottled response to people asking for homework help. But spot135 has done a good job so far: stated his problems, shown his work so far, asking for guidance not answers. And the community has done a good job helping: no answers, but hints and leading questions. I

Re: [Haskell-cafe] Master's thesis topic sought

2009-11-05 Thread Stefan Holdermans
that the old version of the data will never be needed again, and hence update it in-place. Making this kind of thing more automatic could be interesting theoretically and practically. [Warning: shameless plug follows.] Have you had a look at our 2008 PEPM paper? Jurriaan Hage and Stefan Holdermans

Re: [Haskell-cafe] Master's thesis topic sought

2009-11-05 Thread Stefan Holdermans
Erik, http://people.cs.uu.nl/stefan/pubs/hage08heap.html Getting connection refused on that. Don't know: it still works for me. Cheers, Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Resolving overloading loops for circular constraint graph

2009-09-09 Thread Stefan Holdermans
Manuel, Simon, I've spotted a hopefully small but for us quite annoying bug in GHC's type checker: it loops when overloading resolving involves a circular constraint graph containing type-family applications. The following program (also attached) demonstrates the problem: {-# LANGUAGE

Re: [Haskell-cafe] Resolving overloading loops for circular constraint graph

2009-09-09 Thread Stefan Holdermans
Dear Martin, Your example must loop because as you show below the instance declaration leads to a cycle. By black-holing you probably mean co-induction. That is, if the statement to proven appears again, we assume it must hold. However, type classes are by default inductive, so there's no

[Haskell-cafe] Re: Resolving overloading loops for circular constraint graph

2009-09-09 Thread Stefan Holdermans
Dear Martin, By black-holing you probably mean co-induction. That is, if the statement to proven appears again, we assume it must hold. However, type classes are by default inductive, so there's no easy fix to offer to your problem. A propos: are there fundamental objections to coinductive

Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Stefan Holdermans
Conor, I'm scared. What about this? data EQ :: * - * - * where Refl :: EQ x x class Public x where blah :: EQ x Fred instance Public Fred where blah = Refl What happens when I say newtype Jim = Hide Fred deriving Public ? I tried it. I get blah :: EQ Jim Fred It's clear that

Re: newtype deriving, was Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Stefan Holdermans
Conor, What happens when I say newtype Jim = Hide Fred deriving Public ? I tried it. I get blah :: EQ Jim Fred Thinking of it; this *does* make sense in System FC. The newtype- declaration gives you as an axiom Hide :: Jim ~ Fred To give an instance of Public for Jim, we have to

Re: [Haskell-cafe] Oops in Haskell

2009-07-17 Thread Stefan Holdermans
Kashyap, Can someone please send me a working example based on the contents posted in the URL below? There's a small typo in the post: the definition of Proto should read data Proto = Proto {a :: A, b :: B, c :: C} The rest seems fine to me. (See below for an excerpt). Cheers, Stefan

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-17 Thread Stefan Holdermans
Andrew, That seems simple enough (although problematic to implement). However, the Report seems to say that it matters whether or not the bindings are muturally recursive [but I'm not sure precisely *how* it matters...] It means that functions can only be used monomorphically within

Re: [Haskell-cafe] Pattern matching with where free variables can be used more than once

2009-07-17 Thread Stefan Holdermans
Christopher, Wouldn't it be great if pattern variables could be used more than once in a pattern? Like so: foo [x,x,_,x] = The values are the same! foo _ = They're not the same! These are called nonlinear patterns. I think Miranda (a precursor of Haskell, sort of) used to have

Re: [Haskell-cafe] an instance in other than the last type parameters

2009-07-17 Thread Stefan Holdermans
Petr, If I want to make it a functor in the last type variable (b), I can just define instance Functor (X a) where fmap f (X a b) = X a (f b) But how do I write it if I want X to be a functor in its first type variable? Short answer: you can't. Easiest way to workaround is to define

Re: [Haskell-cafe] an instance in other than the last type parameters

2009-07-17 Thread Stefan Holdermans
Petr, Short answer: you can't. Easiest way to workaround is to define a newtype wrapper around your original datatype: newtype X' b a = X' {unX' :: X a b} instance Functor (X' b) where fmap g (X' (X a b)) = X' (X b (g a)) Err fmap g (X' (X a b)) = X' (X (g a) b) Cheers, Stefan

Re: [Haskell-cafe] Circular pure data structures?

2009-07-15 Thread Stefan Holdermans
can be derived in Haskell: Alexey Rodriguez, Stefan Holdermans, Andres Löh, and Johan Jeuring. Generic programming with fixed points for mutually recursive datatypes, 2009. To appear in the proceedings of the 14th ACM SIGPLAN International Conference on Functional Programming, ICFP 2009

Re: [Haskell-cafe] Runtime strictness analysis for polymorphic HOFs?

2009-06-18 Thread Stefan Holdermans
Paul, Did you mean to say that const is strict in its first param and lazy in its second (since const _|_ y = _|_)? Also, can you explain your notation, how does a - {S} - b -{L} a indicate the strictness? Why not just {S} a - {L} b - a? I'm sorry for the confusion. Indeed, const, as the

Re: [Haskell-cafe] Runtime strictness analysis for polymorphic HOFs?

2009-06-17 Thread Stefan Holdermans
Dear Paul, This thread as well as your blog post is very interesting. Hopefully I can add something more or less valuable to it. On your blog, you mention that your scheme for run-time strictness analysis doesn't work out because it'll have you force a function first before you can find

Re: [Haskell-cafe] Runtime strictness analysis for polymorphic HOFs?

2009-06-17 Thread Stefan Holdermans
Ryan, Also, partial application + seq throws a wrench in things: [...] You're absolutely right. I did not take into account the effects of seq in my previous post. However, this is exactly the subject of a paper I presented at TFP, two weeks ago. A revised version of the paper will be

Re: [Haskell-cafe] Runtime strictness analysis for polymorphic HOFs?

2009-06-17 Thread Stefan Holdermans
Paul, In trying to follow your email I got a bit confused by your notation - const :: a - b - a const x y = x could read a - {S} - b - {L} a Here, we have annotated the function-space constructor (-) with information about whether the corresponding function is strict or lazy in

Re: [Haskell-cafe] A generics question

2009-06-08 Thread Stefan Holdermans
Henry, Jason pointed out: You'd get fromEnum and toEnum. Which I think, would give you the int mapping that you are after. fromEnum :: Enum a = a - Int toEnum :: Enum a = Int - a To me, this would indeed seem the way to go for your particular example. Moreover, as for generic producer

Re: [Haskell-cafe] A generics question

2009-06-08 Thread Stefan Holdermans
Henry, Ah, pressed send way to early. Of course, the definition should change a little as well: convert :: Data a = Int - a convert i = xwhere x = fromConstr ( dataTypeConstrs (dataTypeOf x) !! (i - 1) ) Cheers, Stefan ___

Re: [Haskell-cafe] Function Returning Type?

2009-05-21 Thread Stefan Holdermans
Jochem, rationals n = (putStr . unlines . map show) (take n (nub [x % y | y - [1..], x - [1..y], x y])) rationals n :: Integer - [Ratio] I meant Integer - String obviously. Er... what about rationals :: Int - IO () ? ;-) To the original poster: next time, just leave the function

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-21 Thread Stefan Holdermans
I'm sorry, there is no such animal as safe global installation, in the sense of download this one package and do what it says. Well I have been doing that for more then 10 years, it is one of the functions any decent package management systems is designed to do. Time to adopt another goodie

Re: Re[2]: [Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-21 Thread Stefan Holdermans
If we had been interested in raising fierce discussions about n+k patterns or how and where cabal installs things, we could have easily achieved the same effect with much less effort. you mean that we should shoot up? :) If the release of UHC contributes to whatever discussion regarding

Re: [Haskell-cafe] Type family fun

2008-08-24 Thread Stefan Holdermans
Chris, In the inferred type, there should be IxMap l instead of IxMap i, does anybody know what I'm doing wrong? Your calls to empty are just ambiguous. Let's say I want to get a hold of an empty map for A :|: B for some types A and B. And let's say that you've instance for A hanging

Re: [Haskell-cafe] Default definitions for associated type synonyms

2008-06-02 Thread Stefan Holdermans
Isaac, Does anyone know if it is possible to specify a default definition for an associated type synonym? According to http://hackage.haskell.org/trac/ghc/wiki/TypeFunctionsStatus defaults for associated types is still a TODO. Cheers, Stefan

[Haskell-cafe] Small displeasure with associated type synonyms

2008-03-06 Thread Stefan Holdermans
Dear all, I was doing a little experimentation with associated type synonyms and ran into a small but unforeseen annoyance. The following, contrived, example snippets illustrate my pain: First, let us declare some of the simplest classes exhibiting associated type synonyms that I can

[Haskell-cafe] Re: Small displeasure with associated type synonyms

2008-03-06 Thread Stefan Holdermans
Tom, Thanks for your quick answer. The problem is ambiguity. The type checker can't determine which val function to use, i.e. which dictionary to pass to val. I see. Still, maybe a type-error message in terms of good old unresolved top-level overloading would be a bit more useful

Re: [Haskell-cafe] Why purely in haskell?

2008-01-10 Thread Stefan Holdermans
terms can, at any time, be replaced by its value without changing the meaning of the program as a whole. Cheers, Stefan - [1] Jurriaan Hage and Stefan Holdermans. Heap recycling for lazy languages. In John Hatcliff, Robert Glück, and Oege de Moor, editors, _Proceedings of the 2008

Re: [Haskell-cafe] Re: Why can't Haskell be faster?

2007-11-01 Thread Stefan Holdermans
Bernie wrote: I discussed this with Rinus Plasmeijer (chief designer of Clean) a couple of years ago, and if I remember correctly, he said that the native code generator in Clean was very good, and a significant reason why Clean produces (relatively) fast executables. I think he said

Re: [Haskell-cafe] Re: Why can't Haskell be faster?

2007-11-01 Thread Stefan Holdermans
of Jurriaan Hage, Arie Middelkoop, and myself, presented at this year's ICFP [*]---such an analysis is very similar to sharing analysis, which may be used by compilers for lazy languages to avoid unnecessary thunk updates. Cheers, Stefan [*] Jurriaan Hage, Stefan Holdermans, and Arie

Re: [Haskell-cafe] Suspected stupid Haskell Question

2007-10-17 Thread Stefan Holdermans
BH, Is there a library function to take a list of Strings and return a list of ints showing how many times each String occurs in the list. So for example: [egg, egg, cheese] would return [2,1] freq xs = map length (group xs) HTH, Stefan ___

Re: [Haskell-cafe] Pierce on type theory and category theory

2007-09-25 Thread Stefan Holdermans
Seth, You asked: Are Benjamin C. Pierce's _Types and Programming Languages_ and/or _Basic Category Theory for Computer Scientists_ suitable for self-study? And Tim answered: Graduate-level textbooks don't have answers in the back of the book, as a rule. In TAPL, some of the questions

Re: [Haskell-cafe] Monad.Reader 8: Haskell, the new C++

2007-09-12 Thread Stefan Holdermans
C++ : imperative language whose type system is a Turing-complete functional language (with rather twisted syntax) Haskell: functional language whose type system is a Turing- complete logic programming language (with rather twisted syntax)

Re: [Haskell-cafe] Time consumption nub

2007-07-18 Thread Stefan Holdermans
Arie, Ok, so when do I use nub instead of 'map head.group.sort' ? Well, for one thing, |map head . group . sort| produces a sorted list, wheras |nub| preserves the order of the input list. Cheers, Stefan ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Re: Clearly, Haskell is ill-founded

2007-07-16 Thread Stefan Holdermans
Conor's exercise: To that end, an exercise. Implement a codata type data{-codata-} Mux x y = ... which intersperses x's and y's in such a way that (1) an initial segment of a Mux does not determine whether the next element is an x or a y (ie, no forced *pattern* of alternation) (2)

Re: [Haskell-cafe] Re: Clearly, Haskell is ill-founded

2007-07-16 Thread Stefan Holdermans
I wrote: I came up with [...] apfelmus' solution is of course more elegant, but I guess it boils down to the same basic idea. Cheers, Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] let vs do?

2007-06-29 Thread Stefan Holdermans
Thomas, let x = ... in ... is only equal do x - ...; ... in the Identity monad. Also, why would do be more primitive than let. That way you would have to use monads everywhere. Also, let is treated specially by the type checker (IIRC) and there are many, many other reasons not

Re: [Haskell-cafe] Implementing Mathematica

2007-05-31 Thread Stefan Holdermans
Jon, However, I can't think how you might return physically identical results when possible in Haskell. Essentially, you need a higher-order map function: val id_map : ('a - 'a) - 'a t - 'a t that returns its input when f x = x for every x. How might this be done? fmap :: (Functor

Re: [Haskell-cafe] Crazy idea: overloading function application notation

2007-05-31 Thread Stefan Holdermans
Jon, This is a crazy idea I've been working on: overload the syntax x y so it can mean function application f x = f(x) or multiplication x y = x*y. The reason is simply that I appreciate the brevity of MLs function application but I also appreciate the brevity of Mathematica's

Re: [Haskell-cafe] Crazy idea: overloading function application notation

2007-05-31 Thread Stefan Holdermans
Jon, This is a crazy idea I've been working on: overload the syntax x y so it can mean function application f x = f(x) or multiplication x y = x*y. On a related (?) note, but definitely not what you're after: there are constructor classes that allow you to lift function application into

Re: [Haskell-cafe] equations and patterns

2007-05-31 Thread Stefan Holdermans
Dan, If you want to enforce associativity just create your own Eq instance and make it a pattern there. Could you elaborate on that? It's still early here and I've had only one cup of of coffee yet. Cheers, Stefan ___ Haskell-Cafe mailing

Re: [Haskell-cafe] Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Stefan Holdermans
Al, Has there been any work on extending Haskell's type system with structural subtyping? Koji Kagawaga. Polymorphic variants in Haskell. In Andres Loeh, editor, Proceedings of the 2006 ACM SIGPLAN Workshop on Haskell, Portland, Oregon, USA, September 17, 2006, pages 37--47. ACM Press,

Re: [Haskell-cafe] What puts False before True?

2007-05-31 Thread Stefan Holdermans
Brandon, If I'm reading the reports correctly, the Ord instance was actually added in the Haskell 1.1 standard, by changing the definition of Bool from data Bool = True | False to data Bool = True | False deriving (Eq, Ord, Ix, Enum, Text, Binary) It's data Bool = False | True It

Re: [Haskell-cafe] Haskell Quiry

2007-05-31 Thread Stefan Holdermans
Ashutosh, ERROR file:.\-as.hs:5 - Unresolved top-level overloading *** Binding : main *** Outstanding context : (Read c, Read b, Show c, Show b) Add an type annotation: main = do j - readFile sig1.key let (x,y) = (read j) :: (Int, Int)-- - putStrLn (value=

Re: [Haskell-cafe] Language extensions

2007-05-29 Thread Stefan Holdermans
True in principle. But if writing the spec is harder than writing the actual program, all it means is you spend longer trying to figure out how to express intuitively simple concepts using advanced and very abstract and subtle predicate calculus. As it turns out, Haskell sometimes makes a

Re: [Haskell-cafe] Curiose types

2007-05-27 Thread Stefan Holdermans
Andrew, Which is beautifully symmetric. Alternatively, you can think about how you actually use it: map :: ((a - b) - [a]) - [b] I am not following here: what do you mean? Clearly, this is not a valid typing for map. Moreover, modulo undefinedness, there are no functions with this

Re: [Haskell-cafe] Curiose types

2007-05-27 Thread Stefan Holdermans
map :: ((a - b) - [a]) - [b] I am not following here: what do you mean? Clearly, this is not a valid typing for map. Moreover, modulo undefinedness, there are no functions with this typing. map _ = [] Ah, well, and that one, of course... :-) Cheers, Stefan

  1   2   >