{-| Module : FiniteCategories
Description : Helpers for instanciating Show.
Copyright : Guillaume Sabbagh 2021
License : GPL-3
Maintainer : guillaumesabbagh@protonmail.com
Stability : experimental
Portability : portable
Helpers for instanciating Show.
-}
module IO.Show
(
showFunction
)
where
import Data.List (intercalate)
-- | Show a function on a certain domain.
showFunction :: (Show a, Show b) =>
(a -> b) -> [a] -> String
showFunction f xs = "(\\x -> case x of " ++ intercalate ";" [show x ++" -> " ++ show (f x) | x <- xs] ++ ")"