Re: Type/type class information in GHC plugin

2014-04-26 Thread Richard Eisenberg
it to be polymorphic as described above, the transformed GHC Core for an Int - Int function should look like foo = addHook @ GHC.Types.Int @ GHC.Types.Int GHC.Classes.$fOrdInt (\ x - ...) My question is, given the right hand side of foo, how do I construct the type/type class information

Fwd: Type/type class information in GHC plugin

2014-04-24 Thread Shen Chen Xu
for an Int - Int function should look like foo = addHook @ GHC.Types.Int @ GHC.Types.Int GHC.Classes.$fOrdInt (\ x - ...) My question is, given the right hand side of foo, how do I construct the type/type class information inside Core shown above? Cheers, Shen

Re: [Haskell-cafe] Store type-class polymorphic values generically

2013-10-11 Thread Christopher Done
Wait... what do you mean Core cannot generate new names to be exported. I meant if I add a new name in the Core transformation, that doesn't change the module's export list as seen by everything outside that module. Which makes sense, it just means I have to change my approach. Maybe you mean

Re: [Haskell-cafe] Store type-class polymorphic values generically

2013-10-04 Thread Heinrich Apfelmus
Christopher Done wrote: It's very easy to state this problem without enough details and mislead people into providing a solution for a different problem, so I'll try to include all the information and use-case. I need a function that can store a value in a concrete opaque type. I know the type

Re: [Haskell-cafe] Store type-class polymorphic values generically

2013-10-04 Thread Christopher Done
On 4 October 2013 10:56, Heinrich Apfelmus apfel...@quantentunnel.de wrote: In particular, the Locker stores arbitrary values like Dynamic , except that values are extracted and removed with the help of a Key . This gets rid of the Typeable constraint. lock :: Key a - a - Locker I can't

Re: [Haskell-cafe] Store type-class polymorphic values generically

2013-10-04 Thread Heinrich Apfelmus
Christopher Done wrote: On 4 October 2013 10:56, Heinrich Apfelmus apfel...@quantentunnel.de wrote: In particular, the Locker stores arbitrary values like Dynamic , except that values are extracted and removed with the help of a Key . This gets rid of the Typeable constraint. lock ::

Re: [Haskell-cafe] Store type-class polymorphic values generically

2013-10-04 Thread Simon Peyton-Jones
| However, I want to write this as a core-to-core | translation as a ghc-plugin. I want the definition go = putStrLn Hello | World! to be translated to what I wrote above. Core cannot generate new | names to be exported from a module, so go_ is now gone. Wait... what do you mean Core cannot

Re: [Haskell-cafe] Store type-class polymorphic values generically

2013-10-04 Thread Alp Mestanogullari
Hi Chris, Maybe this package (from Edward Kmett, surprisingly) could help: http://hackage.haskell.org/package/constraints-0.3.3/docs/Data-Constraint.html? Considering it kind of reifies the type class constraints, I'm wondering whether you could use this to carry the constraints along the value

[Haskell-cafe] Store type-class polymorphic values generically

2013-10-03 Thread Christopher Done
a. Anything a λ let x = Anything id λ case x of Anything (unsafeCoerce - (id' :: Int - Int)) - id' 123 123 Great, I was able to store a value which contained non-concrete types. But now consider the case of a value with type-class polymorphic type in it: y = Anything (print :: Show a = a - IO

[GHC] #7557: Default implementation for a type class function missing when profiling is enabled

2013-01-08 Thread GHC
#7557: Default implementation for a type class function missing when profiling is enabled -+-- Reporter: JohnWiegley | Owner: Type: bug | Status: new

Re: [GHC] #6117: Cyclic Type Class Hierarchy Produces loop

2012-11-26 Thread GHC
#6117: Cyclic Type Class Hierarchy Produces loop --+- Reporter: jun0 | Owner: simonpj Type: bug | Status: closed Priority

Re: [GHC] #6117: Cyclic Type Class Hierarchy Produces loop

2012-11-23 Thread GHC
#6117: Cyclic Type Class Hierarchy Produces loop +--- Reporter: jun0 | Owner: simonpj Type: bug | Status: new

Re: [GHC] #6117: Cyclic Type Class Hierarchy Produces loop

2012-11-22 Thread GHC
#6117: Cyclic Type Class Hierarchy Produces loop +--- Reporter: jun0 | Owner: simonpj Type: bug | Status: new

Re: [GHC] #6117: Cyclic Type Class Hierarchy Produces loop

2012-10-12 Thread GHC
#6117: Cyclic Type Class Hierarchy Produces loop +--- Reporter: jun0 | Owner: simonpj Type: bug | Status: new

Re: [GHC] #5913: Type class dictionary call loops at runtime

2012-10-12 Thread GHC
#5913: Type class dictionary call loops at runtime -+-- Reporter: mnislaih| Owner: Type: bug | Status: closed Priority

Re: [GHC] #6117: Cyclic Type Class Hierarchy Produces loop

2012-10-11 Thread GHC
#6117: Cyclic Type Class Hierarchy Produces loop +--- Reporter: jun0 | Owner: simonpj Type: bug | Status: new

[GHC] #7252: Impossible error when deriving lower-cased type class (nameModule show{tv a9Y})

2012-09-18 Thread GHC
#7252: Impossible error when deriving lower-cased type class (nameModule show{tv a9Y}) +--- Reporter: sfogarty| Owner: Type: bug | Status: new

Re: [GHC] #7252: Impossible error when deriving lower-cased type class (nameModule show{tv a9Y})

2012-09-18 Thread GHC
#7252: Impossible error when deriving lower-cased type class (nameModule show{tv a9Y}) ---+ Reporter: sfogarty|Owner: Type: bug | Status: closed

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-20 Thread Ryan Ingram
Also, I have to admit I was a bit handwavy here; I meant P in a metatheoretic sense, that is P(a) is some type which contains 'a' as a free variable, and thus the 'theorem' is really a collection of theorems parametrized on the P you choose. For example, P(a) could be Show a a - Int; in that

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-18 Thread wren ng thornton
On 8/17/12 12:54 AM, Alexander Solla wrote: On Thu, Aug 16, 2012 at 8:07 PM, wren ng thornton w...@freegeek.org wrote: Though bear in mind we're discussing second-order quantification here, not first-order. Can you expand on what you mean here? I don't see two kinds of quantification in the

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-16 Thread wren ng thornton
On 8/15/12 12:32 PM, David Feuer wrote: On Aug 15, 2012 3:21 AM, wren ng thorntonw...@freegeek.org wrote: It's even easier than that. (forall a. P(a)) - Q = exists a. (P(a) - Q) Where P and Q are metatheoretic/schematic variables. This is just the usual thing about antecedents being in

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-16 Thread wren ng thornton
On 8/15/12 2:55 PM, Albert Y. C. Lai wrote: On 12-08-15 03:20 AM, wren ng thornton wrote: (forall a. P(a)) - Q = exists a. (P(a) - Q) For example: A. (forall p. p drinks) - (everyone drinks) B. exists p. ((p drinks) - (everyone drinks)) In a recent poll, 100% of respondents think A true,

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-16 Thread Alexander Solla
On Thu, Aug 16, 2012 at 8:07 PM, wren ng thornton w...@freegeek.org wrote: On 8/15/12 2:55 PM, Albert Y. C. Lai wrote: On 12-08-15 03:20 AM, wren ng thornton wrote: (forall a. P(a)) - Q = exists a. (P(a) - Q) For example: A. (forall p. p drinks) - (everyone drinks) B. exists p. ((p

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-15 Thread wren ng thornton
On 8/13/12 9:25 PM, Jay Sulzberger wrote: I did suspect that, in some sense, constraints in combination with forall could give the quantifier exists. It's even easier than that. (forall a. P(a)) - Q = exists a. (P(a) - Q) Where P and Q are metatheoretic/schematic variables. This is

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-15 Thread David Feuer
On Aug 15, 2012 3:21 AM, wren ng thornton w...@freegeek.org wrote: It's even easier than that. (forall a. P(a)) - Q = exists a. (P(a) - Q) Where P and Q are metatheoretic/schematic variables. This is just the usual thing about antecedents being in a negative position, and thus flipping

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-15 Thread Albert Y. C. Lai
On 12-08-15 03:20 AM, wren ng thornton wrote: (forall a. P(a)) - Q = exists a. (P(a) - Q) For example: A. (forall p. p drinks) - (everyone drinks) B. exists p. ((p drinks) - (everyone drinks)) In a recent poll, 100% of respondents think A true, 90% of them think B paradoxical, and

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-15 Thread Ryan Ingram
In classical logic A - B is the equivalent to ~A v B (with ~ = not and v = or) So (forall a. P(a)) - Q {implication = not-or} ~(forall a. P(a)) v Q {forall a. X is equivalent to there does not exist a such that X doesn't hold} ~(~exists a. ~P(a)) v Q {double negation elimination}

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-15 Thread David Feuer
I understand this now, though I still don't understand the context. Thanks! I managed to mix up implication with causation, to my great embarrassment. On Aug 15, 2012 3:39 PM, Ryan Ingram ryani.s...@gmail.com wrote: In classical logic A - B is the equivalent to ~A v B (with ~ = not and v = or)

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-14 Thread Ryan Ingram
On Mon, Aug 13, 2012 at 6:53 PM, Alexander Solla alex.so...@gmail.comwrote: In a classical logic, the duality is expressed by !E! = A, and !A! = E, where E and A are backwards/upsidedown and ! represents negation. In particular, for a proposition P, Ex Px = !Ax! Px (not all x's are not P)

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-13 Thread Johan Holmquist
That pattern looks so familiar. :) Existential types seem to fit in to the type system really well so I never got why it is not part of the standard. On Aug 12, 2012 10:36 AM, Daniel Trstenjak daniel.trsten...@gmail.com wrote: Hi Oleg, On Sat, Aug 11, 2012 at 08:14:47AM -, o...@okmij.org

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-13 Thread Jay Sulzberger
On Mon, 13 Aug 2012, Johan Holmquist holmi...@gmail.com wrote: That pattern looks so familiar. :) Existential types seem to fit in to the type system really well so I never got why it is not part of the standard. On Aug 12, 2012 10:36 AM, Daniel Trstenjak daniel.trsten...@gmail.com wrote:

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-13 Thread Ryan Ingram
On Mon, Aug 13, 2012 at 12:30 PM, Jay Sulzberger j...@panix.com wrote: Does Haskell have a word for existential type declaration? I have the impression, and this must be wrong, that forall does double duty, that is, it declares a for all in some sense like the usual for all of the Lower

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-13 Thread Jay Sulzberger
On Mon, 13 Aug 2012, Ryan Ingram ryani.s...@gmail.com wrote: On Mon, Aug 13, 2012 at 12:30 PM, Jay Sulzberger j...@panix.com wrote: Does Haskell have a word for existential type declaration? I have the impression, and this must be wrong, that forall does double duty, that is, it declares a

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-13 Thread Alexander Solla
On Mon, Aug 13, 2012 at 6:25 PM, Jay Sulzberger j...@panix.com wrote: On Mon, 13 Aug 2012, Ryan Ingram ryani.s...@gmail.com wrote: On Mon, Aug 13, 2012 at 12:30 PM, Jay Sulzberger j...@panix.com wrote: Does Haskell have a word for existential type declaration? I have the impression,

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-13 Thread Jay Sulzberger
On Mon, 13 Aug 2012, Alexander Solla alex.so...@gmail.com wrote: On Mon, Aug 13, 2012 at 6:25 PM, Jay Sulzberger j...@panix.com wrote: On Mon, 13 Aug 2012, Ryan Ingram ryani.s...@gmail.com wrote: On Mon, Aug 13, 2012 at 12:30 PM, Jay Sulzberger j...@panix.com wrote: Does Haskell have

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-12 Thread Heinrich Apfelmus
Antoine Latter wrote: It should be pretty easy to write an adapter function of type String - (Show a = a). The type needs to be String - (exists a. Show a = a) which is equivalent to String - (forall a. Show a = a - c) - c Here is the implementation of the adapter newtype

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-12 Thread Daniel Trstenjak
Hi Oleg, On Sat, Aug 11, 2012 at 08:14:47AM -, o...@okmij.org wrote: I'd like to point out that the only operation we can do on the first argument of MkFoo is to show to it. This is all we can ever do: we have no idea of its type but we know we can show it and get a String. Why not to

[Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-11 Thread oleg
data A = A deriving Show data B = B deriving Show data C = C deriving Show data Foo = forall a. Show a = MkFoo a (Int - Bool) instance Show Foo where show (MkFoo a f) = show a I'd like to point out that the only operation we can do on the first argument of MkFoo is to show to it. This

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-11 Thread David Feuer
Has anyone used existential types to represent items on a schedule in a scheduled lazy data structure? On Aug 11, 2012 4:15 AM, o...@okmij.org wrote: data A = A deriving Show data B = B deriving Show data C = C deriving Show data Foo = forall a. Show a = MkFoo a (Int - Bool)

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-11 Thread Patrick Palka
On Sat, Aug 11, 2012 at 4:14 AM, o...@okmij.org wrote: I'd like to point out that the only operation we can do on the first argument of MkFoo is to show to it. This is all we can ever do: we have no idea of its type but we know we can show it and get a String. That's not all you can do:

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-11 Thread Antoine Latter
It should be pretty easy to write an adapter function of type String - (Show a = a). On Aug 11, 2012 12:34 PM, Patrick Palka patr...@parcs.ath.cx wrote: On Sat, Aug 11, 2012 at 4:14 AM, o...@okmij.org wrote: I'd like to point out that the only operation we can do on the first argument of

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-11 Thread Alexander Solla
On Sat, Aug 11, 2012 at 12:01 PM, Antoine Latter aslat...@gmail.com wrote: It should be pretty easy to write an adapter function of type String - (Show a = a). Not with that type. Give it a try. Hint: what is the extension of the type variable 'a'? What do you know about it? How would

[Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-07 Thread Daniel Trstenjak
Hi all, it should be possible a call a function on all elements of the data structure, to add and remove elements. What I currently have: the type class: class Foo a where hasId :: a - Int - Maybe a a few instances: data A = A deriving Show instance Foo A where hasId a 1 = Just

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-07 Thread Joey Adams
On Tue, Aug 7, 2012 at 2:03 PM, Daniel Trstenjak daniel.trsten...@gmail.com wrote: Data structure containing elements which are instances of the same type class Are you looking for existential quantification [1]? data SomeFoo = forall a. Foo a = a [1]: http://www.haskell.org/ghc/docs

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-07 Thread Daniel Trstenjak
Hi Joey, On Tue, Aug 07, 2012 at 02:13:09PM -0400, Joey Adams wrote: Are you looking for existential quantification [1]? data SomeFoo = forall a. Foo a = a [1]: http://www.haskell.org/ghc/docs/latest/html/users_guide/data-type-extensions.html#existential-quantification Thanks!

Re: [Haskell-cafe] Data structure containing elements which are instances of the same type class

2012-08-07 Thread Alexander Solla
On Tue, Aug 7, 2012 at 11:03 AM, Daniel Trstenjak daniel.trsten...@gmail.com wrote: Hi all, it should be possible a call a function on all elements of the data structure, to add and remove elements. What I currently have: the type class: class Foo a where hasId :: a - Int - Maybe

Re: [Haskell-cafe] specifying using type class

2012-08-01 Thread Patrick Browne
be substituted for the place-holder-constructor. Does this restrict the type of equation that can be used in a type class? It seems that some equations respecting the constructor discipline are not allowed.Your intuition seems to be near the truth, although your terminology iscurrently wrong.  Let's look

Re: [Haskell-cafe] specifying using type class

2012-07-31 Thread Patrick Browne
can be used). In the instance a real constructor can be substituted for the place-holder-constructor.Does this restrict the type of equation that can be used in a type class? It seems that some equations respecting the constructor discipline are not allowed.I appreciate that in Haskell the most

Re: [Haskell-cafe] specifying using type class

2012-07-31 Thread Ertugrul Söylemez
to define functions (I assume other in-scope constructors can be used). In the instance a real constructor can be substituted for the place-holder-constructor. Does this restrict the type of equation that can be used in a type class? It seems that some equations respecting the constructor discipline

Re: [Haskell-cafe] specifying using type class

2012-07-30 Thread Ryan Ingram
in type class. Does the type class need two type variables? How do I represent the constructors? Can the equations be written in the type class rather than the instance? -} module QUEUE_SPEC where data Queue e = New | Insert (Queue e) e deriving Show isEmpty :: Queue e - Bool isEmpty

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Patrick Browne
On 22/07/12, Ertugrul Söylemez e...@ertes.de wrote:You are probably confusing the type class system with something fromOOP.  A type class captures a pattern in the way a type is used.  Thecorresponding concrete representation of that pattern is then written inthe instance definition:   No really

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Alejandro Serrano Mena
I don't know whether this is really applicable but: isn't emptyStack in Ertugrul last message some kind of constructor? You can add any kind of special constructors as functions in the type class which return a new queue. For example: class Stack s where newEmptyStack :: s a newSingletonStack

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Patrick Browne
add any kind of special constructors as functions in the type class which return a new queue. For example: class Stack s where  newEmptyStack :: s a  newSingletonStack :: a - s a  ...Why doesn't this fulfill you needs of specifying ways to construct new elements? 2012/7/23 Patrick Browne

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Alejandro Serrano Mena
to this concrete example. What I was proposing, if you only need constructs, is that instead of thinking of constructors, you may think of a factory pattern, similar to that pattern in OOP: a function that creates the element for you. That would be the newStack in your type class: every instance

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Dominique Devriese
Patrick, -- Class with functional dependency class QUEUE_SPEC_CLASS2 a q | q - a where newC2 :: q a -- ?? sizeC2 :: q a - Int restC2 :: q a - Maybe (q a) insertC2 :: q a - a - q a The above is a reasonable type class definition for what you seem to intend. -- Without

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Patrick Browne
  :: q a - Maybe (q a)    insertC2 :: q a - a - q aThe above is a reasonable type class definition for what you seem to intend. -- Without committing to some concrete representation such as list I do not know how to specify constructor for insertC2 ?? =  ??    insertC2  newC2 a = newC2 -- wrong

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Ertugrul Söylemez
Patrick Browne patrick.bro...@dit.ie wrote: Thank you for your clear an detailed reply, the work on dependent types seems to address my needs. However it is beyond my current research question, which is quite narrow(see[1]). I merely wish to identify the strengths and weakness of *current

[Haskell-cafe] specifying using type class

2012-07-22 Thread Patrick Browne
{-Below is a *specification* of a queue. If possible I would like to write the equations in type class.Does the type class need two type variables? How do I represent the constructors?Can the equations be written in the type class rather than the instance?-}module QUEUE_SPEC wheredata Queue e

Re: [Haskell-cafe] specifying using type class

2012-07-22 Thread Ertugrul Söylemez
Patrick Browne patrick.bro...@dit.ie wrote: {- Below is a *specification* of a queue. If possible I would like to write the equations in type class. Does the type class need two type variables? How do I represent the constructors? Can the equations be written in the type class rather than

Re: [Haskell-cafe] specifying using type class

2012-07-22 Thread Patrick Browne
: {- Below is a *specification* of a queue. If possible I would like to write the equations in type class. Does the type class need two type variables? How do I represent the constructors? Can the equations be written in the type class rather than the instance? -}(Side note:  When opening a new topic

Re: [Haskell-cafe] specifying using type class

2012-07-22 Thread Ertugrul Söylemez
are probably confusing the type class system with something from OOP. A type class captures a pattern in the way a type is used. The corresponding concrete representation of that pattern is then written in the instance definition: class Stacklike s where emptyStack :: s a push

Re: [GHC] #5913: Type class dictionary call loops at runtime

2012-06-15 Thread GHC
#5913: Type class dictionary call loops at runtime -+-- Reporter: mnislaih | Owner: Type: bug | Status: new Priority: normal

Re: [GHC] #5913: Type class dictionary call loops at runtime

2012-05-21 Thread GHC
#5913: Type class dictionary call loops at runtime -+-- Reporter: mnislaih | Owner: Type: bug | Status: new Priority: normal

Re: [GHC] #6117: Cyclic Type Class Hierarchy Produces loop

2012-05-21 Thread GHC
#6117: Cyclic Type Class Hierarchy Produces loop -+-- Reporter: jun0 | Owner: Type: bug | Status: new Priority

Re: [GHC] #6117: Cyclic Type Class Hierarchy Produces loop

2012-05-21 Thread GHC
#6117: Cyclic Type Class Hierarchy Produces loop -+-- Reporter: jun0 | Owner: Type: bug | Status: new Priority

[GHC] #6117: Cyclic Type Class Hierarchy Produces loop

2012-05-19 Thread GHC
#6117: Cyclic Type Class Hierarchy Produces loop -+-- Reporter: jun0 | Owner: Type: bug | Status: new Priority: normal

Re: [GHC] #5913: Type class dictionary call loops at runtime

2012-05-14 Thread GHC
#5913: Type class dictionary call loops at runtime --+- Reporter: mnislaih | Owner: Type: bug | Status: new Priority: normal

Re: [Haskell-cafe] Is type class 'Addressable' already exists.

2012-04-12 Thread Michael Sloan
Hello! Yes, classes of that variety exist in a few packages. This is a particularly good treatment of it: http://hackage.haskell.org/package/keys Here are some classes from a very WIP implementation of a few Commutative Replicated Data Types:

Re: [Haskell-cafe] Is type class 'Addressable' already exists.

2012-04-12 Thread 陈文龙
The Indexable class is declared as class Lookup f = Indexable f where index :: f a - Key f - a Why f must be instance of Lookup? 2012/4/12 Michael Sloan mgsl...@gmail.com Hello! Yes, classes of that variety exist in a few packages. This is a particularly good treatment of it:

Re: [Haskell-cafe] Is type class 'Addressable' already exists.

2012-04-12 Thread Michael Sloan
I think this is the result of a bit of a dilemma: 1) We want to express the fact that any Indexable thing also has a straightforward definition for lookup. 2) Not all things supporting lookup support index, hence the direction of the class hierarchy. This is an ugly part of the default methods

Re: [GHC] #3108: Do a better job of solving recursive type-class constraints with functional dependencies

2012-04-11 Thread GHC
#3108: Do a better job of solving recursive type-class constraints with functional dependencies +--- Reporter: simonpj | Owner: Type: bug

Re: [GHC] #3108: Do a better job of solving recursive type-class constraints with functional dependencies

2012-04-11 Thread GHC
#3108: Do a better job of solving recursive type-class constraints with functional dependencies +--- Reporter: simonpj| Owner: Type: bug

Re: [GHC] #3108: Do a better job of solving recursive type-class constraints with functional dependencies

2012-04-05 Thread GHC
#3108: Do a better job of solving recursive type-class constraints with functional dependencies +--- Reporter: simonpj | Owner: Type: bug

Re: [GHC] #3108: Do a better job of solving recursive type-class constraints with functional dependencies

2012-04-05 Thread GHC
#3108: Do a better job of solving recursive type-class constraints with functional dependencies +--- Reporter: simonpj | Owner: Type: bug

[GHC] #5913: Type class dictionary call loops at runtime

2012-03-04 Thread GHC
#5913: Type class dictionary call loops at runtime --+- Reporter: mnislaih | Owner: Type: bug | Status: new Priority: normal

Re: [GHC] #5913: Type class dictionary call loops at runtime

2012-03-04 Thread GHC
#5913: Type class dictionary call loops at runtime --+- Reporter: mnislaih | Owner: Type: bug | Status: new Priority: normal

Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-10 Thread wren ng thornton
On 1/9/12 7:54 AM, Luminous Fennell wrote: On Mon, Jan 09 2012 at 10:37 +0100, Steve Horne wrote: On 08/01/2012 21:13, Brandon Allbery wrote: (Also, de facto I think it's already more or less been decided in favor of type families, just because functional dependencies are (a) a bit alien

Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-09 Thread Steve Horne
On 08/01/2012 20:25, Brent Yorgey wrote: On Fri, Jan 06, 2012 at 10:51:58AM +, Steve Horne wrote: If I specify both extensions (-XMultiParamTypeClasses and -XFlexibleInstances) it seems to work, but needing two language extensions is a pretty strong hint that I'm doing it the wrong way.

Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-09 Thread Steve Horne
On 08/01/2012 21:13, Brandon Allbery wrote: (Also, de facto I think it's already more or less been decided in favor of type families, just because functional dependencies are (a) a bit alien [being a glob of Prolog-style logic language imported into the middle of System Fc] and (b) [as I

Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-09 Thread Luminous Fennell
Hi, On Mon, Jan 09 2012 at 10:37 +0100, Steve Horne wrote: On 08/01/2012 21:13, Brandon Allbery wrote: (Also, de facto I think it's already more or less been decided in favor of type families, just because functional dependencies are (a) a bit alien [being a glob of Prolog-style logic

Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-08 Thread Brent Yorgey
On Fri, Jan 06, 2012 at 10:51:58AM +, Steve Horne wrote: If I specify both extensions (-XMultiParamTypeClasses and -XFlexibleInstances) it seems to work, but needing two language extensions is a pretty strong hint that I'm doing it the wrong way. Not necessarily. These two extensions in

Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-08 Thread Christoph Breitkopf
On Sun, Jan 8, 2012 at 9:25 PM, Brent Yorgey byor...@seas.upenn.edu wrote: On Fri, Jan 06, 2012 at 10:51:58AM +, Steve Horne wrote: If I specify both extensions (-XMultiParamTypeClasses and -XFlexibleInstances) it seems to work, but needing two language extensions is a pretty strong

Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-08 Thread Brandon Allbery
On Sun, Jan 8, 2012 at 15:55, Christoph Breitkopf chbreitk...@googlemail.com wrote: On Sun, Jan 8, 2012 at 9:25 PM, Brent Yorgey byor...@seas.upenn.eduwrote: On Fri, Jan 06, 2012 at 10:51:58AM +, Steve Horne wrote: If I specify both extensions (-XMultiParamTypeClasses and

[Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-06 Thread Steve Horne
In an equation for `wbtData': wbtData (Branch d l r) = Just d Failed, modules loaded: none. Prelude I've tried varying a number of details. Adding another parameter to the type-class (for the item-data type) requires an extension, and even then the instance is rejected because (I think) the tree-node

Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-06 Thread Steffen Schuldenzucker
another parameter to the type-class (for the item-data type) requires an extension, and even then the instance is rejected because (I think) the tree-node and item-data types aren't independent. Did you try something like {-# LANGUAGE MultiParamTypeClasses #-} class WalkableBinTree n d where

Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-06 Thread Steve Horne
not sure what to make of that. Even if the result of wbtData is always Nothing, surely it still has a static type? I've tried varying a number of details. Adding another parameter to the type-class (for the item-data type) requires an extension, and even then the instance is rejected because (I think

Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-06 Thread Steffen Schuldenzucker
WalkableBinTree take a type constructor of kind (* - *) like this: class WalkableBinTree t where wbtChildren :: t x - (t x, t x) wbtData :: t x - Maybe x instance WalkableBinTree BT where ... Of course, you loose flexibility compared to the multi param approach, e.g. you couldn't add type

Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-06 Thread Philip K. F. Hölzenspies
-cafe@haskell.org Subject: Re: [Haskell-cafe] Simple type-class experiment turns out not so simple... On 06/01/2012 10:29, Steffen Schuldenzucker wrote: With 'd' not being mentioned anywhere, the signature of wbtData means forall d. n - Maybe d. In particular, wbtData == const Nothing

[Haskell-cafe] Type class for sequences with dependent types

2012-01-05 Thread Robbert Krebbers
various kinds of these data structures I defined a type class for common operations on such data structures. class DepSequence l where nil :: l a a app :: l a b - l b c - l a c The instance for AltList is as follows: instance DepSequence AltList where nil = Nil Nil `app` k = k

Re: [Haskell-cafe] Type class for sequences with dependent types

2012-01-05 Thread Markus Läll
structures I defined a type class for common operations on such data structures. class DepSequence l where  nil :: l a a  app :: l a b - l b c - l a c The instance for AltList is as follows: instance DepSequence AltList where  nil = Nil  Nil       `app` k = k  ICons i l `app` k = ICons

Re: [Haskell-cafe] Type class for sequences with dependent types

2012-01-05 Thread Eugene Kirpichov
AltList :: * - * - * where Nil :: AltList a a ICons :: Int - AltList Int b - AltList () b UCons :: () - AltList () b - AltList Int b Since I have various kinds of these data structures I defined a type class for common operations on such data structures. class DepSequence l where nil

Re: [Haskell-cafe] Type class for sequences with dependent types

2012-01-05 Thread Robbert Krebbers
:: () - AltList () b - AltList Int b Since I have various kinds of these data structures I defined a type class for common operations on such data structures. class DepSequence l where nil :: l a a app :: l a b - l b c - l a c The instance for AltList is as follows: instance DepSequence

Re: [GHC] #5691: Crash: strange interaction of ScopedTypeVariables extension with type class name resolution

2011-12-15 Thread GHC
#5691: Crash: strange interaction of ScopedTypeVariables extension with type class name resolution --+- Reporter: dominiquedevriese| Owner: Type: bug

[GHC] #5691: Crash: strange interaction of ScopedTypeVariables extension with type class name resolution

2011-12-12 Thread GHC
#5691: Crash: strange interaction of ScopedTypeVariables extension with type class name resolution +--- Reporter: dominiquedevriese | Owner: Type: bug

Re: [GHC] #5691: Crash: strange interaction of ScopedTypeVariables extension with type class name resolution

2011-12-12 Thread GHC
#5691: Crash: strange interaction of ScopedTypeVariables extension with type class name resolution +--- Reporter: dominiquedevriese | Owner: Type: bug

Re: [Haskell-cafe] The type class wilderness + Separating instances and implementations into separate packages

2011-11-03 Thread Ryan Newton
likely than implementation packages to break when the GHC version changes. Aside: The problem with collections is that we don't have the programming language means to do this well yet (although soon!). The issue is that we want to declare a type class where the context of the methods depends

Re: [Haskell-cafe] The type class wilderness + Separating instances and implementations into separate packages

2011-11-03 Thread Bas van Dijk
On 3 November 2011 14:56, Ryan Newton rrnew...@gmail.com wrote: Aside: The problem with collections is that we don't have the programming language means to do this well yet (although soon!). The issue is that we want to declare a type class where the context of the methods depends

[Haskell-cafe] The type class wilderness + Separating instances and implementations into separate packages

2011-11-02 Thread Ryan Newton
probably go a long way towards taming the type class wilderness. People have mentioned this problem before with respect to Collections generally. One basic part of reaching such a goal is separating interface from implementation. I ran into the following problems just in the last 24 hours. In both

Re: [Haskell-cafe] The type class wilderness + Separating instances and implementations into separate packages

2011-11-02 Thread Johan Tibell
could agree as a community on common interfaces to use for some basics, that would probably go a long way towards taming the type class wilderness. People have mentioned this problem before with respect to Collections generally. Aside: The problem with collections is that we don't have

Re: [Haskell-cafe] type-class inference

2011-08-13 Thread Patrick Browne
typeclasses a type is a member of, use :info. On 12/08/2011 23:52, Patrick Browne wrote: Hi, Why does the Haskell :type command only sometimes print the type-class? Should I expect type-class inference as well as type inference? Maybe the type-class is inferred where possible, but not always

  1   2   3   4   5   6   >