-- | Free theorems plugin
-- Andrew Bromage, 2006
module Lambdabot.Plugin.Haskell.Free (freePlugin) where

import Lambdabot.Plugin
import Lambdabot.Plugin.Haskell.Free.FreeTheorem
import Lambdabot.Plugin.Haskell.Type (query_ghci)

freePlugin :: Module ()
freePlugin :: Module ()
freePlugin = Module ()
forall st. Module st
newModule
    { moduleCmds = return
        [ (command "free")
            { help = say "free <ident>. Generate theorems for free"
            , process = \String
xs -> do
                result <- (String -> Cmd (ModuleT () LB) String)
-> String -> Cmd (ModuleT () LB) String
forall (m :: * -> *).
MonadFail m =>
(String -> m String) -> String -> m String
freeTheoremStr (String -> String -> Cmd (ModuleT () LB) String
forall (m :: * -> *). MonadLB m => String -> String -> m String
query_ghci String
":t") String
xs
                say . unwords . lines $ result
            }
        ]
    }