Browse files

Added a custom Typeable instance for AppConfig to make hint reloading…

… work.
  • Loading branch information...
1 parent 590cc0d commit 9115d36d2824db61b0583dbf4bd23d2e4757fbf4 @mightybyte mightybyte committed Apr 19, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/Snap/Snaplet/Config.hs
View
13 src/Snap/Snaplet/Config.hs
@@ -1,10 +1,12 @@
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE DeriveDataTypeable #-}
module Snap.Snaplet.Config where
import Data.Function
import Data.Maybe
import Data.Monoid
+import Data.Typeable
import Snap.Core
import Snap.Http.Server.Config
import System.Console.GetOpt
@@ -16,6 +18,17 @@ newtype AppConfig = AppConfig { appEnvironment :: Maybe String }
------------------------------------------------------------------------------
+-- | The Typeable instance is here so Snap can be dynamically executed with
+-- Hint.
+appConfigTyCon :: TyCon
+appConfigTyCon = mkTyCon "Snap.Snaplet.Config.AppConfig"
+{-# NOINLINE appConfigTyCon #-}
+
+instance Typeable AppConfig where
+ typeOf _ = mkTyConApp appConfigTyCon []
+
+
+------------------------------------------------------------------------------
instance Monoid AppConfig where
mempty = AppConfig Nothing
mappend a b = AppConfig

0 comments on commit 9115d36

Please sign in to comment.