Browse files

Make Typeable instance for Snap play nicely with hint

  • Loading branch information...
1 parent e97491e commit 8ee59a23de7bdb3444510599656af4417ece9c3c Carl Howells committed Jun 16, 2010
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/Snap/Internal/Types.hs
View
12 src/Snap/Internal/Types.hs
@@ -84,7 +84,7 @@ import Snap.Internal.Http.Types
------------------------------------------------------------------------------
newtype Snap a = Snap {
unSnap :: StateT SnapState (Iteratee IO) (Maybe (Either Response a))
-} deriving Typeable
+}
------------------------------------------------------------------------------
@@ -151,6 +151,16 @@ instance Alternative Snap where
empty = mzero
(<|>) = mplus
+------------------------------------------------------------------------------
+-- | The Typeable instance is here so Snap can be dynamically executed with
+-- Hint.
+snapTyCon :: TyCon
+snapTyCon = mkTyCon "Snap.Types.Snap"
+{-# NOINLINE snapTyCon #-}
+
+instance Typeable1 Snap where
+ typeOf1 _ = mkTyConApp snapTyCon []
+
------------------------------------------------------------------------------
liftIter :: Iteratee IO a -> Snap a

0 comments on commit 8ee59a2

Please sign in to comment.