aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Reducer.hs
blob: 31ed3da47e2d949e14f168aed20a7ef7365d136b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-- MIT License, Copyright (c) 2024 Marvin Borner
module Reducer
  ( reduce
  , reduceNoIO
  ) where

import           Helper
import qualified Reducer.HigherOrder           as HigherOrder
import qualified Reducer.ION                   as ION
import qualified Reducer.RKNL                  as RKNL

reduce :: EvalConf -> Expression -> IO Expression
reduce conf e = case _reducer conf of
  "RKNL"        -> RKNL.reduce e
  "ION"         -> pure $ ION.reduce e
  "HigherOrder" -> pure $ HigherOrder.reduce e
  _             -> error "Invalid reducer"

reduceNoIO :: Expression -> Expression
reduceNoIO = HigherOrder.reduce