<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Here is a more complete example without my ramblings to disturb you.
Imagine the code being distributed across three files.<br>
<pre>---
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
---
module Test where
import qualified Data.Bool under (Default, Data.Aspect.Bool.All) as A_All_ (Bool)
import qualified Data.Bool under (Default, Data.Aspect.Bool.Any) as A_Any_ (Bool)
allEven :: (Integral a) => [a] -> A_All_.Bool
allEven = foldMap even -- uses instance from 'All' aspect
anyOdd :: (Integral a) => [a] -> A_Any_.Bool
anyOdd = foldMap odd -- uses instance from 'Any' aspect
test :: (Integral a) => [a] -> Bool -- no need for qualification
test xs = allEven xs == not (anyOdd xs) -- works because booleanss are still booleans
</pre>
</body>
</html>