Skip to content

Commit

Permalink
Remove epAstPrint
Browse files Browse the repository at this point in the history
It is not used
  • Loading branch information
alanz committed May 21, 2024
1 parent 825f1ee commit 671c8b4
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/Language/Haskell/GHC/ExactPrint/ExactPrint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module Language.Haskell.GHC.ExactPrint.ExactPrint
, makeDeltaAst

-- * Configuration
, EPOptions(epAstPrint, epTokenPrint, epWhitespacePrint)
, EPOptions(epTokenPrint, epWhitespacePrint)
, stringOptions
, epOptions
, deltaOptions
Expand Down Expand Up @@ -129,34 +129,27 @@ defaultEPState = EPState
-- | The R part of RWS. The environment. Updated via 'local' as we
-- enter a new AST element, having a different anchor point.
data EPOptions m a = EPOptions
{
epAstPrint :: forall ast . Data ast => GHC.Located ast -> a -> m a
, epTokenPrint :: String -> m a
{ epTokenPrint :: String -> m a
, epWhitespacePrint :: String -> m a
}

-- | Helper to create a 'EPOptions'
epOptions ::
(forall ast . Data ast
=> GHC.Located ast -> a -> m a)
-> (String -> m a)
-> (String -> m a)
-> EPOptions m a
epOptions astPrint tokenPrint wsPrint = EPOptions
{
epAstPrint = astPrint -- Not used
, epWhitespacePrint = wsPrint
epOptions :: (String -> m a)
-> (String -> m a)
-> EPOptions m a
epOptions tokenPrint wsPrint = EPOptions
{ epWhitespacePrint = wsPrint
, epTokenPrint = tokenPrint
}

-- | Options which can be used to print as a normal String.
stringOptions :: EPOptions Identity String
stringOptions = epOptions (\_ b -> return b) return return
stringOptions = epOptions return return

-- | Options which can be used to simply update the AST to be in delta
-- form, without generating output
deltaOptions :: EPOptions Identity ()
deltaOptions = epOptions (\_ _ -> return ()) (\_ -> return ()) (\_ -> return ())
deltaOptions = epOptions (\_ -> return ()) (\_ -> return ())

data EPWriter a = EPWriter
{ output :: !a }
Expand Down

0 comments on commit 671c8b4

Please sign in to comment.