on master help sign in
implement hlint suggestions
commitc07d5d7a8ed42a314f67133c11257e9452e8b22a authorAgentM <agentm@themactionfaction.com> dateMon 4 Jun 2018, 18:09 (8 years ago) parent35993a3
3 files changed+11−6
src/lib/ProjectM36/Arbitrary.hs+1−1 src/lib/ProjectM36/Atom.hs+1−1 src/lib/ProjectM36/DataTypes/Interval.hs+9−4
src/lib/ProjectM36/Arbitrary.hs+1−1
@@ -76,7 +76,7 @@ maybeToRight _ (Just x) = Right x
7676maybeToRight y Nothing = Left y
7777
7878instance Arbitrary Text where
79− arbitrary = pack <$> (elements $ map (replicate 3) ['A'..'Z'])
79+ arbitrary = pack <$> elements (map (replicate 3) ['A'..'Z'])
8080
8181instance Arbitrary Day where
8282 arbitrary = ModifiedJulianDay <$> (arbitrary :: Gen Integer)
src/lib/ProjectM36/Atom.hs+1−1
@@ -22,7 +22,7 @@ atomToText (BoolAtom i) = (T.pack . show) i
2222atomToText (RelationAtom i) = (T.pack . show) i
2323atomToText (ConstructedAtom dConsName typ atoms)
2424 | isIntervalAtomType typ = case atoms of --special handling for printing intervals
25− (b:e:(BoolAtom bo):(BoolAtom be):[]) ->
25+ [b, e, BoolAtom bo, BoolAtom be] ->
2626 let beginp = if bo then "(" else "["
2727 begin = atomToText b
2828 end = atomToText e
src/lib/ProjectM36/DataTypes/Interval.hs+9−4
@@ -15,9 +15,7 @@ intervalSubType :: AtomType -> AtomType
1515intervalSubType typ = if isIntervalAtomType typ then
1616 case typ of
1717 ConstructedAtomType _ tvMap ->
18− case M.lookup "a" tvMap of
19− Nothing -> err
20− Just typ' -> typ'
18+ fromMaybe err (M.lookup "a" tvMap)
2119 _ -> err
2220 else
2321 err
@@ -121,7 +119,14 @@ isIntervalAtomType (ConstructedAtomType nam tvMap) =
121119isIntervalAtomType _ = False
122120
123121intervalOverlaps :: Atom -> Atom -> Either AtomFunctionError Bool
124−intervalOverlaps (ConstructedAtom dCons1 typ1 (i1start:i1end:(BoolAtom i1startopen):(BoolAtom i1endopen):[])) (ConstructedAtom dCons2 typ2 (i2start:i2end:(BoolAtom i2startopen):(BoolAtom i2endopen):[])) = do
122+intervalOverlaps (ConstructedAtom dCons1 typ1 [i1start,
123+ i1end,
124+ BoolAtom i1startopen,
125+ BoolAtom i1endopen]) (ConstructedAtom dCons2 typ2
126+ [i2start,
127+ i2end,
128+ BoolAtom i2startopen,
129+ BoolAtom i2endopen]) = do
125130 when (dCons1 /= "Interval" || dCons2 /= "Interval" || not (isIntervalAtomType typ1) || not (isIntervalAtomType typ2)) (Left AtomFunctionTypeMismatchError)
126131 cmp1 <- atomCompare i1start i2end
127132 cmp2 <- atomCompare i2start i1end