X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fparser%2FHaddockParse.y;h=c0f64d45ad26451a749a0b01d94fb3127acffe0f;hb=a4005d2d0c18ffa72ba7bd0fa052666e70e8c16e;hp=e3f45f9475e1cf543b2ba7db9f9110ed4ef34c83;hpb=1168a37f6bfad3d7025ecb21b9917799937936f3;p=ghc-hetmet.git diff --git a/compiler/parser/HaddockParse.y b/compiler/parser/HaddockParse.y index e3f45f9..c0f64d4 100644 --- a/compiler/parser/HaddockParse.y +++ b/compiler/parser/HaddockParse.y @@ -1,5 +1,5 @@ { -{-# OPTIONS -w #-} +{-# OPTIONS -Wwarn -w #-} -- The above warning supression flag is a temporary kludge. -- While working on this module you are encouraged to remove it and fix -- any warnings in the module. See @@ -9,7 +9,7 @@ module HaddockParse ( parseHaddockParagraphs, parseHaddockString, - MyEither(..) + EitherString(..) ) where import {-# SOURCE #-} HaddockLex @@ -17,6 +17,8 @@ import HsSyn import RdrName } +%expect 0 + %tokentype { Token } %token '/' { TokSpecial '/' } @@ -35,7 +37,7 @@ import RdrName PARA { TokPara } STRING { TokString $$ } -%monad { MyEither String } +%monad { EitherString } %name parseHaddockParagraphs doc %name parseHaddockString seq @@ -98,15 +100,18 @@ strings :: { String } | STRING strings { $1 ++ $2 } { -happyError :: [Token] -> MyEither String a +happyError :: [Token] -> EitherString a happyError toks = MyLeft ("parse error in doc string") -- We don't want to make an instance for Either String, -- since every user of the GHC API would get that instance -data MyEither a b = MyLeft a | MyRight b +-- But why use non-Haskell98 instances when MyEither String +-- is the only MyEither we're intending to use anyway? --Isaac Dupree +--data MyEither a b = MyLeft a | MyRight b +data EitherString b = MyLeft String | MyRight b -instance Monad (MyEither String) where +instance Monad EitherString where return = MyRight MyLeft l >>= _ = MyLeft l MyRight r >>= k = k r