{-# OPTIONS -fglasgow-exts -fallow-undecidable-instances -fallow-overlapping-instances #-}

module Autolib.Informed where

import Autolib.ToDoc

class Informed i where
      -- | zeigt Information
      info     :: i -> Doc

      -- | ändert Information
      informed :: Doc -> i -> i

      texinfo  :: i -> String
      texinfo = Doc -> String
forall a. Show a => a -> String
show (Doc -> String) -> (i -> Doc) -> i -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. i -> Doc
forall i. Informed i => i -> Doc
info

      texinformed :: String -> i -> i
      texinformed String
cs = Doc -> i -> i
forall i. Informed i => Doc -> i -> i
informed (String -> Doc
text String
cs)

-- instance ToDoc i => Informed i where info = toDoc

-- | konstruiere info-doc für Funktions-Aufruf
funni :: String -> [ Doc ] -> Doc
funni :: String -> [Doc] -> Doc
funni String
f [Doc]
args = Doc -> Doc
parens (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ [Doc] -> Doc
fsep ( String -> Doc
text String
f Doc -> [Doc] -> [Doc]
forall a. a -> [a] -> [a]
: [Doc]
args )