%include lhs2TeX.fmt
%include WKlhs.sty
\section{Minimal Interface Providing Generic Cast}

This module provides a minimal interface to |gcast|
since this is all that is really required by many applications
of |Typeable| and friends.

Isolating this interface
makes it easier to switch between different implementations.

%{-# OPTIONS_GHC -fglasgow-exts #-}  taken out for lhs2tex
\begin{code}
module GCast
 ( Typeable()
 , Typeable1()
 , Typeable2()
 , Typeable3()
 , cast
 , gcast
 , gcast1
 , gcast2
 , ofEqType
 ) where

-- import Data.Typeable
import Typeable
\end{code}

\begin{code}
ofEqType :: (Typeable a, Typeable b) => a -> b -> Bool
ofEqType (x :: a) (y :: b) = case cast x :: Maybe b of
  Just _ -> True
  Nothing -> False
\end{code}

%{{{ EMACS lv
% Local Variables:
% folded-file: t
% fold-internal-margins: 0
% eval: (fold-set-marks "%{{{ " "%}}}")
% eval: (fold-whole-buffer)
% end:
%}}}
