Skip to content

Commit

Permalink
Location: Semigroup deprecated Option in ghc-9.0
Browse files Browse the repository at this point in the history
It will be removed in 9.2, so just use Maybe
  • Loading branch information
juhp committed Jul 3, 2021
1 parent 859f13e commit b08fa38
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Language/Haskell/Exts/Location.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import Language.Haskell.Exts.Syntax
--
-- The location only indicates the beginning of a range, because that's what
-- haskell-src-exts provides.
type Located a = Writer (Option (Min SrcLoc)) a
type Located a = Writer (Maybe (Min SrcLoc)) a

located :: SrcLoc -> Located ()
located srcLoc | srcLoc == noLoc = tell $ Option $ Nothing
| otherwise = tell $ Option $ Just $ Min srcLoc
located srcLoc | srcLoc == noLoc = tell $ Nothing
| otherwise = tell $ Just $ Min srcLoc

annotated :: (Annotated ast, SrcInfo si) => ast si -> Located (ast si)
annotated x = do
Expand All @@ -28,4 +28,4 @@ annotated x = do
runLocated :: Located a -> (a, Maybe SrcLoc)
runLocated = go . runWriter
where
go (x, p) = (x, fmap getMin $ getOption $ p)
go (x, p) = (x, fmap getMin $ p)

0 comments on commit b08fa38

Please sign in to comment.