]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Implant/Rewrite.hs
Fixed lots of bugs
[Lucu.git] / Network / HTTP / Lucu / Implant / Rewrite.hs
index 9abf628b50c3f6c0142d71d28f81215cbfa6dc3c..affa89791d0cbe520fcc124e9232fadaea5978d7 100644 (file)
@@ -81,6 +81,7 @@ data RewriteRule
       , rrImps ∷ !Imports
       }
 
+-- |@'insert' imp@ merges @imp@ with an existing one if any.
 instance Unfoldable Imports ImportOp where
     insert qi@(QualifiedImp   {}) (Imports s) = Imports $ insert qi s
     insert ui@(UnqualifiedImp {}) (Imports s)
@@ -101,17 +102,22 @@ instance Unfoldable Imports ImportOp where
                   (_      , Nothing ) → ui'
                   (Just ns, Just ns') → ui { impNames = Just (ns ⊕ ns') }
 
+    empty     = Imports empty
+    singleton = Imports ∘ singleton
+
+-- FIXME: auto-derive
 instance Foldable Imports ImportOp where
     foldr f b (Imports s) = foldr f b s
 
+-- FIXME: auto-derive
 instance Collection Imports ImportOp where
     filter f (Imports s) = Imports $ filter f s
 
 instance Monoid Imports where
-    mempty = empty
-    mappend (Imports α) (Imports β)
-        = Imports $ insertManySorted β α
+    mempty  = empty
+    mappend = insertMany
 
+-- FIXME: auto-derive
 instance Map Imports ImportOp () where
     lookup k (Imports s) = lookup k s
     mapWithKey f (Imports m)
@@ -127,9 +133,11 @@ instance Map Imports ImportOp () where
     isProperSubmapBy f (Imports α) (Imports β)
         = isProperSubmapBy f α β
 
+-- FIXME: auto-derive
 instance Set Imports ImportOp where
     haddock_candy = haddock_candy
 
+-- FIXME: auto-derive
 instance SortingCollection Imports ImportOp where
     minView (Imports s) = second Imports <$> minView s