1 {-# OPTIONS_GHC -cpp -fglasgow-exts #-} 2 {-# LANGUAGE CPP #-} 3 4 module Darcs.Show(Show1(..), Show2(..), showOp2, app_prec) where 5 6 #include "gadts.h" 7 8 class Show1 a where 9 show1 :: a C(x) -> String 10 show1 x = showsPrec1 0 x "" 11 showsPrec1 :: Int -> a C(x) -> ShowS 12 showsPrec1 _ x s = show1 x ++ s 13 14 class Show2 a where 15 show2 :: a C(x y) -> String 16 show2 x = showsPrec2 0 x "" 17 showsPrec2 :: Int -> a C(x y) -> ShowS 18 showsPrec2 _ x s = show2 x ++ s 19 20 showOp2 :: (Show2 a, Show2 b) => Int -> String -> Int -> a C(w x) -> b C(y z) -> String -> String 21 showOp2 prec opstr d x y = showParen (d > prec) $ showsPrec2 (prec + 1) x . 22 showString opstr . showsPrec2 (prec + 1) y 23 24 app_prec :: Int 25 app_prec = 10