| Now, I am scared. This should be regarded as a bug in generalised
| newtype deriving, shouldn't it? I would expect newtype deriving to be
| unable to come up with instances that cannot be written by hand.
|
| I would have expected people out on the streets marching to GHC
| headquarters
On 18 Jul 2009, at 16:49, Wolfgang Jeltsch wrote:
Am Samstag, 18. Juli 2009 08:58 schrieb Miguel Mitrofanov:
Oops... Sorry, wrong line. Should be
isAB :: forall p. p A - p B - p x
Is this a well-known approach for closing classes?
I have an impression that this is kinda folklore. But I
What is it for? Yes, you would know that only A and B are Public, but
you have no way of telling that to the compiler.
I usually prefer something like that:
class Public x where
blah :: ...
isAB :: forall y. (A - y) - (B - y) - x - y
Both solutions, however, allow the user to declare some
Oops... Sorry, wrong line. Should be
isAB :: forall p. p A - p B - p x
On 18 Jul 2009, at 10:51, Miguel Mitrofanov wrote:
What is it for? Yes, you would know that only A and B are Public,
but you have no way of telling that to the compiler.
I usually prefer something like that:
class
Hi Miguel
On 18 Jul 2009, at 07:58, Miguel Mitrofanov wrote:
Oops... Sorry, wrong line. Should be
isAB :: forall p. p A - p B - p x
Yep, dependent case analysis, the stuff of my thesis,...
On 18 Jul 2009, at 10:51, Miguel Mitrofanov wrote:
What is it for?
I have a different purpose in
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
On 18 Jul 2009, at 01:43, Lennart Augustsson wrote:
As far as I know it works. It's an old Oleg trick.
Then it probably does work.
The only drawback is that error messages may refer to Private.
As I found out when probing its security. No instance for Moo.Private
shows up. I guess that's
Hi Stefan
On 18 Jul 2009, at 09:42, Stefan Holdermans wrote:
Conor,
What happens when I say
newtype Jim = Hide Fred deriving Public
? I tried it. I get
blah :: EQ Jim Fred
It's clear that GeneralizedNewtypeDeriving goes too far.
Now, I am scared. This should be regarded as a bug in
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
Am Samstag, 18. Juli 2009 11:43 schrieb Conor McBride:
The trouble here is that somewhere along the line (GADTs? earlier?)
it became possible to construct candidates for p :: * - * which don't
respect isomorphism.
Hello Conor,
I’m not sure whether I exactly understand what you mean here. I
On Fri, Jul 17, 2009 at 4:38 PM, Conor
McBrideco...@strictlypositive.org wrote:
class Private x where
public :: (forall x. Public x = x - y) - y
public f = f Pike
data Pike = Pike
instance Private Pike
instance Public Pike
--
But if I don't tell 'em
Am Samstag, 18. Juli 2009 08:58 schrieb Miguel Mitrofanov:
Oops... Sorry, wrong line. Should be
isAB :: forall p. p A - p B - p x
Is this a well-known approach for closing classes?
I came across the same idea and implemented a generic framework for closing
classes in this way. I did this to
Hi Wolfgang
On 18 Jul 2009, at 13:42, Wolfgang Jeltsch wrote:
Am Samstag, 18. Juli 2009 11:43 schrieb Conor McBride:
The trouble here is that somewhere along the line (GADTs? earlier?)
it became possible to construct candidates for p :: * - * which
don't
respect isomorphism.
Hello Conor,
Friends
Is closing a class this easy?
--
module Moo
( Public(..)
) where
class Private x = Public x where
blah :: ...
class Private x where
instance Private A where
instance Public A where
blah = ...
instance Private B where
instance Public B
I've used a similar approach for a while, for instance in
http://comonad.com/haskell/type-int/src/Data/Type/Boolean.hs
http://comonad.com/haskell/type-int/src/Data/Type/Boolean.hs
But I think your approach is cleaner than mine, because it doesn't need my
seemingly superfluous closure term or
15 matches
Mail list logo