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

import           Helper
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
  _      -> error "Invalid reducer"

unsafeReduce :: Expression -> Expression
unsafeReduce = RKNL.unsafeReduce