Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/tests/nofib/real/infer/Shows.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


module  Shows
      (Shows, showsEmpty, showsConcat, showsString, showsChar, showsStar,
       showsStarSep, showsSurround, showsListOf, showsParen, showsParenIf)
      where

type  Shows x  =  x -> ShowS
showsEmpty                    :: ShowS
showsEmpty r                  =  r
showsConcat                   :: [ShowS] -> ShowS
showsConcat                   =  foldr (.) showsEmpty
showsString                   :: Shows String
showsString                   =  (++)
showsChar                     :: Shows Char
showsChar                     =  (:)
showsStar                     :: Shows x -> Shows [x]
showsStar showsX xs           =  showsConcat (map showsX xs)
showsStarSep                  :: String -> Shows x -> Shows [x]
showsStarSep s showsX []      =  showsEmpty
showsStarSep s showsX (x:xs)  =  showsX x
                              .  showsConcat [showString s . showsX x' | x' <- xs]
showsSurround                 :: String -> Shows x -> String -> Shows x
showsSurround l showsX r x    =  showString l . showsX x . showString r
showsListOf                   :: Shows x -> Shows [x]
showsListOf showsX            =  showsSurround "[" (showsStarSep ", " showsX) "]"
showsParen                    :: ShowS -> ShowS
showsParen                    =  showsSurround "(" id ")"
showsParenIf                  :: Bool -> ShowS -> ShowS
showsParenIf b xS             =  if  b  then  showsParen xS  else  xS

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.