projects
/
matthijs
/
master-project
/
cλash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fd283d8
)
Make HsValueMap an instance of Functor.
author
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Mon, 9 Feb 2009 16:18:40 +0000
(17:18 +0100)
committer
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Mon, 9 Feb 2009 16:18:40 +0000
(17:18 +0100)
Flatten.hs
patch
|
blob
|
history
diff --git
a/Flatten.hs
b/Flatten.hs
index 7ce63a536a40595211a59e8888e065adf4931080..42ce020766849b3e16204d78d397ca9f3f00d870 100644
(file)
--- a/
Flatten.hs
+++ b/
Flatten.hs
@@
-17,7
+17,9
@@
data HsValueMap mapto =
| Single mapto
deriving (Show, Eq)
| Single mapto
deriving (Show, Eq)
-
+instance Functor HsValueMap where
+ fmap f (Single s) = Single (f s)
+ fmap f (Tuple maps) = Tuple (fmap (fmap f) maps)
-- | Creates a HsValueMap with the same structure as the given type, using the
-- given function for mapping the single types.
-- | Creates a HsValueMap with the same structure as the given type, using the
-- given function for mapping the single types.
@@
-57,8
+59,7
@@
type SignalUseMap = HsValueMap SignalUse
type SignalDefMap = HsValueMap SignalDef
useMapToDefMap :: SignalUseMap -> SignalDefMap
type SignalDefMap = HsValueMap SignalDef
useMapToDefMap :: SignalUseMap -> SignalDefMap
-useMapToDefMap (Single (SignalUse u)) = Single (SignalDef u)
-useMapToDefMap (Tuple uses) = Tuple (map useMapToDefMap uses)
+useMapToDefMap = fmap (\(SignalUse u) -> SignalDef u)
type SignalId = Int
data SignalUse = SignalUse {
type SignalId = Int
data SignalUse = SignalUse {