module Managed.ProbeDescription
( mkDescription
, human
) where
import Data.Managed
import Managed.Probe
mkDescription :: ProbeID -> Probe e -> ProbeDescription
mkDescription :: ProbeID -> Probe e -> ProbeDescription
mkDescription ProbeID
pid Probe e
probe =
ProbeDescription :: ProbeID -> ProbeID -> [ProbeID] -> ProbeID -> ProbeDescription
ProbeDescription
{ probeID :: ProbeID
probeID = ProbeID
pid
, probeType :: ProbeID
probeType = TypeRep -> ProbeID
forall a. Show a => a -> ProbeID
show (TypeRep -> ProbeID) -> TypeRep -> ProbeID
forall a b. (a -> b) -> a -> b
$ Probe e -> TypeRep
forall e. Probe e -> TypeRep
typeRep Probe e
probe
, probeParams :: [ProbeID]
probeParams = (TypeRep -> ProbeID) -> [TypeRep] -> [ProbeID]
forall a b. (a -> b) -> [a] -> [b]
Prelude.map TypeRep -> ProbeID
forall a. Show a => a -> ProbeID
show ([TypeRep] -> [ProbeID]) -> [TypeRep] -> [ProbeID]
forall a b. (a -> b) -> a -> b
$ Probe e -> [TypeRep]
forall e. Probe e -> [TypeRep]
params Probe e
probe
, probeReturns :: ProbeID
probeReturns = TypeRep -> ProbeID
forall a. Show a => a -> ProbeID
show (TypeRep -> ProbeID) -> TypeRep -> ProbeID
forall a b. (a -> b) -> a -> b
$ Probe e -> TypeRep
forall e. Probe e -> TypeRep
returns Probe e
probe
}
human :: ProbeDescription -> String
human :: ProbeDescription -> ProbeID
human ProbeDescription
pd = [ProbeID] -> ProbeID
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ProbeDescription -> ProbeID
probeID ProbeDescription
pd, ProbeID
" :: ", ProbeDescription -> ProbeID
probeType ProbeDescription
pd]