type families and overlapping

2008-12-17 Thread Jorge Marques Pelizzoni
Hi, While playing with type families in GHC 6.10.1, I guess I bumped into the no-overlap restriction. As I couldn't find any examples on that, I include the following (non-compiling) code so as to check with you if that's really the case: --- {-# OPTIONS

[Haskell] detecting existing instances

2008-01-09 Thread Jorge Marques Pelizzoni
Hi, all! I guess this belongs to haskell-cafe or glasgow-haskell-users, but I've already been there and got no replies. Thanks in advance for anyone taking the time to read on. Given two type classes A t and B t, I'd like the typechecker to derive different A t instances depending exactly on

Re: [Haskell] detecting existing instances

2008-01-09 Thread Jorge Marques Pelizzoni
Thank you very much, Ralf, for your very thorough reply. That's a very general way to deal with the issue. It never occurred to me that the inspected class itself might carry the availability info. Cheers, Jorge. Ralf Laemmel escreveu: Given two type classes A t and B t, I'd like the

reifying is-a relation

2008-01-07 Thread Jorge Marques Pelizzoni
Hi, all! I guess what I am about to ask is currently impossible, but as you haskellers always manage to amaze me and there is plenty of new features in GHC I am not familiar with here it goes. Given two type classes A t and B t, I'd like to derive different A t instances depending exactly on

[Haskell-cafe] reifying is-a

2008-01-06 Thread Jorge Marques Pelizzoni
Hi, all! I guess what I am about to ask is currently impossible, but as you haskellers always manage to amaze me here it goes. Given two type classes A t and B t, I'd like to derive (two) different A t instances depending exactly on whether t is an instance of B. In other words, is it possible

Re: [Haskell] Empty instance declaration

2007-12-27 Thread Jorge Marques Pelizzoni
instance Show WeekDay where (empty) You see, an empty instance like that may serve various purposes. In type-level programming, for example, they (roughly) correspond to facts in logic programming. However, in the case at hand, this is what happens: the doc for class Show reads thus: Minimal

Re: [Haskell-cafe] libSDL [Tetris]

2007-11-21 Thread Jorge Marques Pelizzoni
Andrew Coppin escreveu: ...yep, configure fails because it can't find sh. (Again.) You are probably not using cygwin, are you? I mean, it includes sh and should get you going. Just make sure to check all you need in the cygwin setup. Cheers, Jorge.

[Haskell] [Fwd: undecidable overlapping instances: a bug?]

2007-10-16 Thread Jorge Marques Pelizzoni
Assunto: undecidable overlapping instances: a bug? De: Jorge Marques Pelizzoni [EMAIL PROTECTED] Data:Sab, Outubro 13, 2007 5:59 am Para:GHC users [EMAIL PROTECTED] -- Hi, all! I am quite intrigued

undecidable overlapping instances: a bug?

2007-10-13 Thread Jorge Marques Pelizzoni
Hi, all! I am quite intrigued at the behaviour examplified in the attached module. It's true I am a newbie and probably don't quite get the whole consequence spectrum of -fallow-undecidable-instances, but why providing that dummy instance (commented out) get the thing to compile? By the way, I'm

is -fno-monomorphism-restriction evil?

2007-10-09 Thread Jorge Marques Pelizzoni
Hi, all! It may be a side-effect of being a newbie, but many times I find the -fno-monomorphism-restriction quite handy. Is it intrinsically evil? I mean, has anyone had a bad time using it or does it imply some runtime performance overhead? I guess it is not portable, is it? Thanks in advance.

Re: [Haskell-cafe] Re: Function composition

2007-10-04 Thread Jorge Marques Pelizzoni
Adapting my previous class sample with these ideas, we have: class Multicompose t1 t2 t3 | t1 t2 - t3 where infixr 9 +. (+.)::t1 - t2 - t3 instance Multicompose t1 t2 t3 = Multicompose t1 (a - t2) (a - t3) where (+.) = (.).(+.) instance Multicompose (b - c) (a - b) (a -

Re: [Haskell-cafe] Function composition

2007-10-03 Thread Jorge Marques Pelizzoni
Here is a generalized version, using type classes and some extensions. Tiago, in order to compile this you'll have to use: -fglasgow-exts -fallow-undecidable-instances -fallow-overlapping-instances Cheers, Jorge. - module Main where class Pipeline t1 t2 t3 | t1 t2 - t3 where

[Haskell-cafe] unsafePerformIO: are we safe?

2007-09-26 Thread Jorge Marques Pelizzoni
Hi, all! This is a newbie question: I sort of understand what unsafePerformIO does but I don't quite get its consequences. In short: how safe can one be in face of it? I mean, conceptually, it allows any Haskell function to have side effects just as in any imperative language, doesn't it?

Re: [Haskell-cafe] unsafePerformIO: are we safe?

2007-09-26 Thread Jorge Marques Pelizzoni
Thanks! That's very clarifying. Bulat Ziganshin escreveu: Hello Jorge, Wednesday, September 26, 2007, 6:43:15 PM, you wrote: This is a newbie question: I sort of understand what unsafePerformIO does but I don't quite get its consequences. In short: how safe can one be in face of it? i