Verified Commit 130cd4db authored by Camil Staps's avatar Camil Staps 🙂

Add parentheses around infix operators in instance definitions

parent 44f2e54d
......@@ -22,7 +22,7 @@ where
instance + Idents
where
+ a b = removeLocalGlobals
(+) a b = removeLocalGlobals
{ locals = union a.locals b.locals
, globals = union a.globals b.globals
, record_fields = union a.record_fields b.record_fields
......
......@@ -213,6 +213,7 @@ location :: !Library !String !FilePath !LineNr !LineNr !Name -> Location
instance zero Location
instance == Location
instance < Location
instance zero FunctionEntry
instance zero ModuleEntry
......
......@@ -29,6 +29,7 @@ from Data.Map import :: Map(..), elems, filterWithKey, foldrNoKey,
toAscList, toList, instance Functor (Map k)
import Data.Map.GenJSON
import Data.Maybe
import Data.Maybe.Ord
import Data.NGramIndex
import qualified Data.NGramIndex
import Data.Tuple
......@@ -85,14 +86,29 @@ printersperse ia a bs = intercalate (print False a) (map (print ia) bs)
instance zero Location where zero = NoLocation
derive gLexOrd Location, Maybe, CleanLangReportLocation
instance < Location where < a b = (a =?= b) === LT
instance < Location
where
(<) (Location l1 m1 _ d1 i1 n1) (Location l2 m2 _ d2 i2 n2)
= ((l1,m1,n1),(d1,i1)) < ((l2,m2,n2), (d2,i2))
(<) (Location _ _ _ _ _ _) _
= True
(<) _ (Location _ _ _ _ _ _)
= False
(<) (Builtin a _) (Builtin b _)
= a < b
(<) (Builtin _ _) _
= True
(<) _ _
= False
instance == Location
where
== (Location a b c d e f) (Location p q r s t u)
= and [a==p, b==q, c==r, d==s, e==t, f==u]
== (Builtin a _) (Builtin b _) = a == b
== NoLocation NoLocation = True
== _ _ = False
(==) (Location a b c d e f) (Location p q r s t u)
= a==p && b==q && c==r && d==s && e==t && f==u
(==) (Builtin a _) (Builtin b _) = a == b
(==) NoLocation NoLocation = True
(==) _ _ = False
instance zero FunctionEntry
where
......
......@@ -99,7 +99,7 @@ from Cloogle.DB import
:: ABCInstructionEntry{..}, :: ABCArgument,
instance zero FunctionEntry, instance zero ModuleEntry,
class getLocation, instance getLocation CloogleEntry,
instance == Location,
instance == Location, instance < Location,
location
:: TemporaryDB
......@@ -124,27 +124,6 @@ newTemporaryDB
, temp_modules = []
}
instance < (Maybe a) | < a
where
< (Just x) (Just y) = x < y
< (Just _) Nothing = True
< _ _ = False
instance < Location
where
< ('Cloogle.DB'.Location l1 m1 _ d1 i1 n1) ('Cloogle.DB'.Location l2 m2 _ d2 i2 n2)
= ((l1,m1,n1),(d1,i1)) < ((l2,m2,n2), (d2,i2))
< ('Cloogle.DB'.Location _ _ _ _ _ _) _
= True
< _ ('Cloogle.DB'.Location _ _ _ _ _ _)
= False
< (Builtin a _) (Builtin b _)
= a < b
< (Builtin _ _) _
= True
< _ _
= False
class match a :: !a !FilePath -> Bool
instance match PathPattern
......@@ -815,6 +794,7 @@ where
field_doc = fromMaybe [] (docFields =<< 'Cloogle.DB'.getTypeDefDoc etd) ++ repeat Nothing
instance == (a,b,c,d) | == a & == b & == c & == d
where == (a,b,c,d) (p,q,r,s) = a == p && b == q && c == r && d == s
where
(==) (a,b,c,d) (p,q,r,s) = a == p && b == q && c == r && d == s
fth4 (a,b,c,d) :== d
Subproject commit 37aeaea78b5f3e5d87b3da8b4dcbe6b6f1a44fdb
Subproject commit 3e23fd513045b76b87a54f0fb7ab899813039d1f
Subproject commit 9c799bda1eef4749bf1e7e4c606bb32b962a0d37
Subproject commit 842bc1032e887b892d8c8905621258bd7e17838d
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment