{-# LANGUAGE ExistentialQuantification #-}-- | QuickReadShow is designed for the rapid manufacture of read/show-- instances. To create such an instance you need to (a) instance-- quickRead; (b) instance Read/Show using a particular template.-- (Before April 2004 (b) was not part of the code; it now has to-- be added to deal with tougher GHC restrictions on overlapping instances.)moduleUtil.QuickReadShow(WrapRead(WrapRead),QuickRead(quickRead),qRead,WrapShow(WrapShow),QuickShow(quickShow),qShow)wheredataWrapReadtoRead=forallread.Readread=>WrapRead(read->toRead)classQuickReadtoReadwherequickRead::WrapReadtoReadmkReadsPrec::WrapReadtoRead->Int->ReadStoReadmkReadsPrec(WrapReadconvFn)precstr=letparses=readsPrecprecstrinmap(\(result,rest)->(convFnresult,rest))parsesqRead::QuickReadtoRead=>Int->String->[(toRead,String)]qRead=mkReadsPrecquickRead{- Example instance
instance Read ExampleType where
readsPrec = qRead
-}dataWrapShowtoShow=forallshow.Showshow=>WrapShow(toShow->show)classQuickShowtoShowwherequickShow::WrapShowtoShowmkShowsPrec::WrapShowtoShow->Int->toShow->ShowSmkShowsPrec(WrapShowconvFn)precvalueacc=showsPrecprec(convFnvalue)accqShow::QuickShowtoShow=>Int->toShow->String->StringqShow=mkShowsPrecquickShow{- Example instance
instance Show ExampleType where
showsPrec = qShow
-}