[Haskell-cafe] Language extension proposal: aspects
Ruben Astudillo
ruben.astud at gmail.com
Sat May 6 18:43:09 UTC 2017
On 06/05/17 14:14, MarLinn wrote:
> Here is a more complete example without my ramblings to disturb you.
Imagine the
> code being distributed across three files.
>
> ---
> aspect Data.Aspect.Bool.All where
>
> instance Monoid Bool where
> mempty = True
> mappend False _ = False
> mappend True b = b
>
> ---
> aspect Data.Aspect.Bool.Any where
>
> instance Monoid Bool where
> mempty = False
> mappend True _ = True
> mappend False b = b
how would this interact with superclasses
class Monoid m => Newclass m
As I understand the proposal, you got default instances. But how do you
extend with the alternative instance? by you examples with foldMap you
would need to extend the data type with the aspect you mean to do it,
well that is exactly what newtypes are! thus far I don't see any
benefits of making it less explicit.
--
-- Ruben
More information about the Haskell-Cafe
mailing list