On 2 February 2011 02:25, Sebastian Fischer wrote:
> It's a nice trick! Although it does look strange, it may be reasonable to
> allow pattern bindings in instance declarations regardless of the original
> proposal. Is it correct that, currently, pattern bindings are allowed
> everywhere but in in
On Tue, Feb 1, 2011 at 9:23 PM, Ben Millwood wrote:
> On Tue, Feb 1, 2011 at 9:52 AM, Max Bolingbroke
> wrote:
> >
> > Local declarations at module scope can be emulated using pattern
> bindings:
> >
> > """
> > (foo, bar) = (foo, bar)
> > where
> >foo = ..
> >bar = ..
> >private = .
On Tue, Feb 1, 2011 at 9:52 AM, Max Bolingbroke
wrote:
>
> Local declarations at module scope can be emulated using pattern bindings:
>
> """
> (foo, bar) = (foo, bar)
> where
> foo = ..
> bar = ..
> private = ...
> """
>
> If instance declarations supported pattern bindings you could ge
On 27 January 2011 17:11, Iavor Diatchki wrote:
> instance Num Wrapped where
> local
> lift2 f (Wrapped a) (Wrapped b) = Wrapped (f a b)
> lift f (Wrapped a) = Wrapped (f a)
> in
> (+) = lift2 (+)
> (-) = lift2 (-)
> (*) = lift2 (*)
> abs = lift abs
> signum = l
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 1/30/11 05:54 , John Meacham wrote:
>> instance Num Wrapped where
>> (+) = lift2 (+)
>> (-) = lift2 (-)
>> (*) = lift2 (*)
>> abs = lift abs
>> signum = lift signum
>> fromInteger = Wrapped
>> where
>>lift2 f (Wrapped a)
On Thu, Jan 27, 2011 at 3:07 AM, Boris Lykah wrote:
> I think it would be convenient to allow adding variables and
> functions, which are not members of the class, to a class instance so
> that they are visible only in the instance scope. It will help if the
> same functions are used by several c
Thanks for pointing at the problems with new and default class
functions. But if we distinct the local and class functions I see no
other problems.
Iavor, your local/in suggestion is very interesting. I would like to
see local declarations in the Haskell standard some day. However, it
affects much
On 2011-01-27 13:07 +0200, Boris Lykah wrote:
> I think it would be convenient to allow adding variables and
> functions, which are not members of the class, to a class instance so
> that they are visible only in the instance scope. It will help if the
> same functions are used by several class fu
Hello,
One issue I can see with such a change is that now it is not obvious which
declarations define methods in the instance, and which are just helper
functions. For example, currently, if I mistype the name of a method in a
class (which happens often), the program is rejected because there is
I think it would be convenient to allow adding variables and
functions, which are not members of the class, to a class instance so
that they are visible only in the instance scope. It will help if the
same functions are used by several class functions.
Example:
When implementing Num class for my
10 matches
Mail list logo