Lennart Augustsson writes:
[...]
> Slightly more interesting might be
> data Foo = forall a . Foo a (a -> Int)
>
> Now you can at least apply the function to the value after pattern
> matching. You don't have to carry any types around, because the
> type system ensures that you don't misu
> > > data Any = forall a. Any a
> > >
> > > get :: Any -> Maybe Char
> > > get (Any (c::Char)) = Just c -- bad
> > > get _ = Nothing
..
> It can also be questioned from a software engineering standpoint. Much
> of the purpose with existential types is to provide information hiding;
> that is, th
On 30-Jan-2001, Johan Nordlander <[EMAIL PROTECTED]> wrote:
> It can also be questioned from a software engineering standpoint. Much
> of the purpose with existential types is to provide information hiding;
> that is, the user of an existentially quantified type is not supposed to
> know its conc
Ashley Yakeley wrote:
>
> At 2001-01-30 23:11, Johan Nordlander wrote:
>
> >However, this whole idea gets forfeited if it's possible to look behind
> >the abstraction barrier by pattern-matching on the representation.
>
> Isn't this information-hiding more appropriately achieved by hiding the
>
At 2001-01-30 23:11, Johan Nordlander wrote:
>However, this whole idea gets forfeited if it's possible to look behind
>the abstraction barrier by pattern-matching on the representation.
Isn't this information-hiding more appropriately achieved by hiding the
constructor?
--
data IntOrChar = Mk
Lennart Augustsson wrote:
>
> Ashley Yakeley wrote:
>
> > data Any = forall a. Any a
> >
> > get :: Any -> Maybe Char
> > get (Any (c::Char)) = Just c -- bad
> > get _ = Nothing
> > --
> >
> > ...but as it stands, this is not legal Haskell, according to Hugs:
> >
> > ERROR "test.hs" (line 4): Ty
On 31-Jan-2001, Lennart Augustsson <[EMAIL PROTECTED]> wrote:
> Ashley Yakeley wrote:
>
> > data Any = forall a. Any a
> >
> > get :: Any -> Maybe Char
> > get (Any (c::Char)) = Just c -- bad
> > get _ = Nothing
> > --
> >
> > ...but as it stands, this is not legal Haskell, according to Hugs:
> >
Ashley Yakeley wrote:
> At 2001-01-30 22:16, Lennart Augustsson wrote:
>
> >It has large and horrible implications. To do dynamic type tests you need
> >to carry around the types at runtime. This is not something that Haskell
> >does (at least you don't have to).
>
> Hmm. In this:
>
> --
> data
At 2001-01-30 22:16, Lennart Augustsson wrote:
>It has large and horrible implications. To do dynamic type tests you need
>to carry around the types at runtime. This is not something that Haskell
>does (at least you don't have to).
Hmm. In this:
--
data Any = forall a. Any a
a1 = Any 3
a2 =
Ashley Yakeley wrote:
> data Any = forall a. Any a
>
> get :: Any -> Maybe Char
> get (Any (c::Char)) = Just c -- bad
> get _ = Nothing
> --
>
> ...but as it stands, this is not legal Haskell, according to Hugs:
>
> ERROR "test.hs" (line 4): Type error in application
> *** Expression : Any c
At 2001-01-30 19:52, Fergus Henderson wrote:
>On 30-Jan-2001, Ashley Yakeley <[EMAIL PROTECTED]> wrote:
>> At 2001-01-30 02:37, Fergus Henderson wrote:
>>
>> >class BaseClass s where
>> >downcast_to_derived :: s -> Maybe Derived
>>
>> Exactly what I was trying to avoid, since now every base
11 matches
Mail list logo