[Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Thomas van Noort
Hello all, I'm having difficulties understanding rank-2 polymorphism in combination with overloading. Consider the following contrived definition: f :: (forall a . Eq a = a - a - Bool) - Bool f eq = eq True True Then, we pass f both an overloaded function and a regular polymorphic function:

Re: [Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Thomas van Noort
On 26-4-2010 20:13, Jochem Berndsen wrote: Thomas van Noort wrote: ... f requires a function that is able to compute, for two values of type a (which instantiates Eq), a Boolean. y certainly fulfills that requirement: it does not even require that the values are of a type instantiating Eq

Re: [Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Thomas van Noort
On 26-4-2010 20:12, Daniel Fischer wrote: Am Montag 26 April 2010 19:52:23 schrieb Thomas van Noort: ... Yes, y's type is more general than the type required by f, hence y is an acceptable argument for f - even z :: forall a b. a - b - Bool is. That's what I thought. I've just never seen

[Haskell-cafe] ANNOUNCE: Generic Haskell 1.80 (Emerald)

2008-04-12 Thread Thomas van Noort
PROTECTED] [1] Thomas van Noort. Generic views for generic types. Master's thesis, Utrecht University, 2008. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] ANNOUNCE: Generic Haskell 1.80 (Emerald)

2008-04-12 Thread Thomas van Noort
structure type. Regards, Thomas On 12/04/2008, Thomas van Noort [EMAIL PROTECTED] wrote: Generic Haskell includes the following features: * type-indexed values -- generic functions that can be instantiated on all Haskell data types. ^^^ I have perused

Re: [Haskell-cafe] ANNOUNCE: Generic Haskell 1.80 (Emerald)

2008-04-12 Thread Thomas van Noort
On 12/04/2008, Thomas van Noort [EMAIL PROTECTED] wrote: That's a good question. Unfortunately, only Haskell98 types are currently supported by the Generic Haskell compiler. I thought constrained types were Haskell 98, but now I'm in doubt... I'm not 100% sure either, but according

Re: [Haskell-cafe] ANNOUNCE: Generic Haskell 1.80 (Emerald)

2008-04-14 Thread Thomas van Noort
Pablo Nogueira wrote: This has certainly been taken into account when comparing approaches to generic programming. I quote from page 18/19 from the work you and Bulat Indeed I was not aware of it. Missed that. Thanks for pointing it out! Thus, full reflexivity of an approach is taken into

[Haskell-cafe] Re: [Haskell] ANNOUNCE: Generic Haskell 1.80 (Emerald)

2008-04-22 Thread Thomas van Noort
Hello, I took the liberty to move this discussion to the Haskell-Cafe mailing list. Adrian Hey wrote: Thomas van Noort wrote: Pleasant programming, Hello, This looks like good stuff. But having done all this work it seems a pity not to go the extra mm and cabalise this and make

Re: [Haskell-cafe] Overriding a Prelude function?

2009-04-22 Thread Thomas van Noort
You can hide () from the implicit import of Prelude using: import Prelude hiding (()) Kind regards, Thomas michael rice wrote: I've been working through this example from: http://en.wikibooks.org/wiki/Haskell/Understanding_monads I understand what they're doing all the way up to the

Re: [Haskell-cafe] Type constraints and classes

2009-04-26 Thread Thomas van Noort
This is a recurring problem[1] and I'm still looking for a really satisfying solution. The only working and non-verbose solution I found is the one Miguel suggests. Although I'm not too fond of splitting up the monadic functions into separate type classes. A similar solution is described

[Haskell-cafe] Type family signatures

2009-08-14 Thread Thomas van Noort
Hello, I have a question regarding type family signatures. Consider the following type family: type family Fam a :: * Then I define a GADT that takes such a value and wraps it: data GADT :: * - * where GADT :: a - Fam a - GADT (Fam a) and an accompanying unwrapper: unwrap ::

Re: [Haskell-cafe] Type family signatures

2009-08-17 Thread Thomas van Noort
Somehow I didn't receive David's mail, but his explanation makes a lot of sense. I'm still wondering how this results in a type error involving rigid type variables. Ryan Ingram wrote: On Fri, Aug 14, 2009 at 12:03 PM, Dan Westonweston...@imageworks.com wrote: But presumably he can use a

Re: [Haskell-cafe] Type family signatures

2009-08-19 Thread Thomas van Noort
Thank your for this elaborate explanation, you made my day! Thomas Ryan Ingram wrote: On Mon, Aug 17, 2009 at 12:12 AM, Thomas van Noorttho...@cs.ru.nl wrote: Somehow I didn't receive David's mail, but his explanation makes a lot of sense. I'm still wondering how this results in a type error

[Haskell-cafe] Verifying a list of properties using QuickCheck

2008-10-20 Thread Thomas van Noort
Hi, I would like to verify a list of properties using QuickCheck. Of course, I can test a single property using: quickCheck :: Testable prop = prop - IO () Then, I can check a list of properties my mapping this function over a list: quickCheckL :: Testable prop = [prop] - IO () quickCheckL

[Haskell-cafe] ANNOUNCE: rewriting-0.1

2008-10-22 Thread Thomas van Noort
datatypes or with nested datatypes. This library has been described in the paper: A Lightweight Approach to Datatype-Generic Rewriting. Thomas van Noort, Alexey Rodriguez, Stefan Holdermans, Johan Jeuring, Bastiaan Heeren. ACM SIGPLAN Workshop on Generic Programming 2008. More information

[Haskell-cafe] Proposal for associated type synonyms in Template Haskell

2008-11-05 Thread Thomas van Noort
Hello, Recently, we released a library on Hackage for generic rewriting (package rewriting if you are curious). The user of the library is expected to define type class instances to enable rewriting on his or her own datatypes. As these instances follow the datatype declarations closely, we

Re: [Haskell-cafe] Proposal for associated type synonyms in Template Haskell

2008-11-12 Thread Thomas van Noort
://hackage.haskell.org/trac/ghc/ticket/1673). Maybe it would be good if the remaining syntax (associated datatypes and type families) would also be defined and implemented in TH. Or maybe there isn't much demand for this?... Cheers, Pedro On Wed, Nov 5, 2008 at 15:57, Thomas van Noort [EMAIL

Re: [Haskell-cafe] ANNOUNCE: rewriting-0.1

2008-11-13 Thread Thomas van Noort
Hi Greg, We didn't look into nominal rewriting I'm afraid. And I'm not that familiar with scrap-your-nameplate so I'm not sure if you can implement nominal rewriting using that library. Regards, Thomas Greg Meredith wrote: Thomas, Did you explore nominal rewrite at all? Do you know if it

Re: [Haskell-cafe] Performance question

2009-02-26 Thread Thomas van Noort
First thing I noticed, how about removing the sqrt in isInCircle: isInCircle :: (Floating a, Ord a) = (a,a) - Bool isInCircle (x,y) = x*x + y*y = 1.0 But you can remove sqrt from the C++ implementation as well, so it only improves the relative performance if the C++ implementation of sqrt is

Re: [Haskell-cafe] Performance question

2009-02-26 Thread Thomas van Noort
But you can remove sqrt from the C++ implementation as well, so it only improves the relative performance if the C++ implementation of sqrt is worse than its Haskell counterpart. Oops, of course I mean, you only improve if Haskell's implementation is worse than C++'s implementation :)