on master help sign in
fix hlint suggestions
commit58e2c65c6dbecc125cb887160ff5fe329f744da8 authorAgentM <agentm@themactionfaction.com> dateFri 22 Sep 2017, 00:14 (9 years ago) parente7bc48f
3 files changed+6−7
src/lib/ProjectM36/Atom.hs+1−1 src/lib/ProjectM36/Relation/Parse/CSV.hs+3−4 test/Relation/Export/CSV.hs+2−2
src/lib/ProjectM36/Atom.hs+1−1
@@ -30,7 +30,7 @@ atomToText (RelationAtom i) = (T.pack . show) i
3030atomToText (ConstructedAtom dConsName _ atoms) = dConsName <> dConsArgs
3131 where
3232 parensAtomToText a@(ConstructedAtom _ _ []) = atomToText a
33− parensAtomToText a@(ConstructedAtom _ _ _) = "(" <> atomToText a <> ")"
33+ parensAtomToText a@ConstructedAtom{} = "(" <> atomToText a <> ")"
3434 parensAtomToText a = atomToText a
3535
3636 dConsArgs = case atoms of
src/lib/ProjectM36/Relation/Parse/CSV.hs+3−4
@@ -8,7 +8,7 @@ import qualified ProjectM36.Attribute as A
88
99import Data.Csv.Parser
1010import qualified Data.Vector as V
11−import Data.Char (ord)
11+import Data.Char (ord, isUpper, isSpace)
1212import qualified Data.ByteString.Lazy as BS
1313import Data.Text.Encoding (decodeUtf8)
1414import qualified Data.Set as S
@@ -21,7 +21,6 @@ import Control.Arrow
2121import Text.Read hiding (parens)
2222import Control.Applicative
2323import Data.Either
24−import Data.Char
2524
2625data CsvImportError = CsvParseError String |
2726 AttributeMappingError RelationalError |
@@ -104,7 +103,7 @@ parseCSVAtomP attrName tConsMap typ@(ConstructedAtomType _ tvmap) = do
104103 -- grab the data constructor
105104 case findDataConstructor dConsName tConsMap of
106105 Nothing -> pure (Left (NoSuchDataConstructorError dConsName))
107− Just (_, dConsDef) -> do
106+ Just (_, dConsDef) ->
108107 -- identify the data constructor's expected atom type args
109108 case resolvedAtomTypesForDataConstructorDefArgs tConsMap tvmap dConsDef of
110109 Left err -> pure (Left err)
@@ -112,7 +111,7 @@ parseCSVAtomP attrName tConsMap typ@(ConstructedAtomType _ tvmap) = do
112111 atomArgs <- mapM (\argTyp -> let parseNextAtom = parseCSVAtomP attrName tConsMap argTyp <* APT.skipSpace in
113112 case argTyp of
114113 ConstructedAtomType _ _ ->
115− (parens parseNextAtom) <|>
114+ parens parseNextAtom <|>
116115 parseNextAtom
117116 _ -> parseNextAtom
118117 ) argAtomTypes
test/Relation/Export/CSV.hs+2−2
@@ -75,10 +75,10 @@ testCSVExport = TestCase $ do
7575
7676 case relOrErr of
7777 Left err -> assertFailure $ "export relation creation failure: " ++ show err
78− Right rel -> do
78+ Right rel ->
7979 case relationAsCSV rel of
8080 Left err -> assertFailure $ "export failed: " ++ show err
81− Right csvData -> do
81+ Right csvData ->
8282 --putStrLn (TL.unpack (TE.decodeUtf8 csvData))
8383 case csvAsRelation attrs basicTypeConstructorMapping csvData of -- import csv data back to relation
8484 Left err -> assertFailure $ "re-import failed: " ++ show err