{-# LANGUAGE ExistentialQuantification #-}
module Conferer.Source.Internal where
import Data.Text (Text)
import Conferer.Key (Key)
data Source = forall s. (IsSource s, Show s) => Source s
instance Show Source where
show :: Source -> String
show (Source s
s) = String
"Source " String -> ShowS
forall a. [a] -> [a] -> [a]
++ s -> String
forall a. Show a => a -> String
show s
s
class IsSource s where
getKeyInSource :: s -> Key -> IO (Maybe Text)
getSubkeysInSource :: s -> Key -> IO [Key]
instance IsSource Source where
getKeyInSource :: Source -> Key -> IO (Maybe Text)
getKeyInSource (Source s
source) =
s -> Key -> IO (Maybe Text)
forall s. IsSource s => s -> Key -> IO (Maybe Text)
getKeyInSource s
source
getSubkeysInSource :: Source -> Key -> IO [Key]
getSubkeysInSource (Source s
source) =
s -> Key -> IO [Key]
forall s. IsSource s => s -> Key -> IO [Key]
getSubkeysInSource s
source