On Sat, Dec 27, 2008 at 2:24 PM, Andrew Wagner wagner.and...@gmail.com wrote:
I'm sure there's a way to do this, but it's escaping me at present. I want
to do something like this:
data Foo = Bar a = Foo a Bool ...
That is, I want to create a new type, Foo, whose constructor takes both a
On Sat, Dec 27, 2008 at 12:44 PM, David Menendez d...@zednenem.com wrote:
On Sat, Dec 27, 2008 at 2:24 PM, Andrew Wagner wagner.and...@gmail.com
wrote:
I'm sure there's a way to do this, but it's escaping me at present. I
want
to do something like this:
data Foo = Bar a = Foo a Bool
Seems like you want an existential type:
data Foo = forall a. Bar a = Foo a Bool
On 27 Dec 2008, at 22:24, Andrew Wagner wrote:
I'm sure there's a way to do this, but it's escaping me at present.
I want to do something like this:
data Foo = Bar a = Foo a Bool ...
That is, I want to create
There is a disadvantage in GADTs. They don't work in Hugs.
On 27 Dec 2008, at 22:49, Luke Palmer wrote:
On Sat, Dec 27, 2008 at 12:44 PM, David Menendez d...@zednenem.com
wrote:
On Sat, Dec 27, 2008 at 2:24 PM, Andrew Wagner wagner.and...@gmail.com
wrote:
I'm sure there's a way to do this,
Hmm, I actually simplified my problem too much. What I actually want is:
data Foo a = forall a. Bar a = Foo a Bool
...except I want the 'a' on the left to match the 'a' on the right, so
that you can only construct values out of values of the parameterized
type, which also must be of the Bar
Oh! That's much simplier:
data Bar a = Foo a = Foo a Bool
On 27 Dec 2008, at 23:09, Andrew Wagner wrote:
Hmm, I actually simplified my problem too much. What I actually want
is:
data Foo a = forall a. Bar a = Foo a Bool
...except I want the 'a' on the left to match the 'a' on the right,
Andrew Wagner wrote:
Hmm, I actually simplified my problem too much. What I actually want is:
data Foo a = forall a. Bar a = Foo a Bool
...except I want the 'a' on the left to match the 'a' on the right, so
that you can only construct values out of values of the parameterized
type, which also
On Sat, Dec 27, 2008 at 3:09 PM, Andrew Wagner wagner.and...@gmail.com wrote:
Hmm, I actually simplified my problem too much. What I actually want is:
data Foo a = forall a. Bar a = Foo a Bool
...except I want the 'a' on the left to match the 'a' on the right, so that
you can only construct
| class ToRenderable a b where
| toRenderable :: a - Renderable b
But the above is, I think, too general for my needs. I don't want
to be able to generate Renderables of different type b for a single input
type a.
Sounds like a functional dependency (class ToReadable a b | a - b )
On Thu, 11 Sep 2008, Tim Docker wrote:
I have a typeclass related question that I have been puzzling over.
In a library I am working on, I have a series of functions for
converting values to Renderables:
| labelToRenderable :: Label - Renderable
| legendToRenderable :: Legend - Renderable
|
Also, MPTC take me out of the world of haskell 98, which I was trying
to avoid.
Why. Everyone does it,
Well, it's a library that others might use, so I would prefer to avoid
using language extensions, especially functional deps which I don't
understand, and which seem to have an uncertain
(Henning:)
If there is no algorithm that becomes more generic by the use of a type
class,
I would not use a type class, but stick to labelToRenderable [...]
The problem with function names as labelToRenderable
is that they have type information as part of the name.
Consistency of that
Well, it's a library that others might use, so I would prefer to avoid
using language extensions, especially functional deps which I don't
understand, and which seem to have an uncertain future.
I think there will be a storm of protest
if support for this simple shape of dependencies ( ... |
On Thu, 2008-09-11 at 13:23 +0200, Johannes Waldmann wrote:
Well, it's a library that others might use, so I would prefer to avoid
using language extensions, especially functional deps which I don't
understand, and which seem to have an uncertain future.
I think there will be a storm of
if support for this simple shape of dependencies ( ... | a - b ) ...
For backwards-compatibility reasons,
Yes.
or because you think they're better than type families?
Don't know (haven't used them).
Concrete example: I have this class Partial p i b | p i - b
On Thu, 2008-09-11 at 18:34 +0200, Johannes Waldmann wrote:
if support for this simple shape of dependencies ( ... | a - b ) ...
For backwards-compatibility reasons,
Yes.
This gives point, then, to my concerns about letting Haskell become a
practical language. At some point,
Hi Tim,
Your example seems like a perfect fit for functional dependencies.
On Thu, Sep 11, 2008 at 3:36 AM, Tim Docker [EMAIL PROTECTED] wrote:
Well, it's a library that others might use, so I would prefer to avoid
using language extensions, especially functional deps which I don't
understand,
On Sun, Dec 03, 2006 at 12:26:30PM -0500, Jonathan Tang wrote:
I've got what's probably a beginner's question, but I'm out of ideas
for solving it. It looks like it tripped me up in Write Yourself a
Scheme... too, since the code there seems like it's arranged so I
never ran into it...
I've
18 matches
Mail list logo