@@ -43,20 +43,20 @@ import Language.Haskell.TH.Syntax hiding (Extension (..))
43
43
-- * template-haskell
44
44
45
45
parsePat :: String -> Either String Pat
46
- parsePat = either Left ( Right . toPat) . parseHsPat
46
+ parsePat = fmap toPat . parseHsPat
47
47
48
48
parseExp :: String -> Either String Exp
49
- parseExp = either Left ( Right . toExp) . parseHsExp
49
+ parseExp = fmap toExp . parseHsExp
50
50
51
51
parseType :: String -> Either String Type
52
- parseType = either Left ( Right . toType) . parseHsType
52
+ parseType = fmap toType . parseHsType
53
53
54
54
parseDecs :: String -> Either String [Dec ]
55
- parseDecs = either Left ( Right . toDecs) . parseHsDecls
55
+ parseDecs = fmap toDecs . parseHsDecls
56
56
57
57
-- | @since 0.8.2
58
58
parseDecsWithMode :: ParseMode -> String -> Either String [Dec ]
59
- parseDecsWithMode parseMode = either Left ( Right . toDecs)
59
+ parseDecsWithMode parseMode = fmap toDecs
60
60
. parseHsDeclsWithMode parseMode
61
61
62
62
-----------------------------------------------------------------------------
@@ -93,12 +93,12 @@ parseHsModule :: String -> Either String (Hs.Module Hs.SrcSpanInfo)
93
93
parseHsModule = parseResultToEither . parseModuleWithMode myDefaultParseMode
94
94
95
95
parseHsDecls :: String -> Either String [Hs. Decl Hs. SrcSpanInfo ]
96
- parseHsDecls = either Left ( Right . moduleDecls)
96
+ parseHsDecls = fmap moduleDecls
97
97
. parseResultToEither . parseModuleWithMode myDefaultParseMode
98
98
99
99
-- | @since 0.8.2
100
100
parseHsDeclsWithMode :: ParseMode -> String -> Either String [Hs. Decl Hs. SrcSpanInfo ]
101
- parseHsDeclsWithMode parseMode = either Left ( Right . moduleDecls)
101
+ parseHsDeclsWithMode parseMode = fmap moduleDecls
102
102
. parseResultToEither . parseModuleWithMode parseMode
103
103
104
104
0 commit comments