Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Conditional Typeable deriving for GHC versions. #184

Closed
wants to merge 1 commit into from

5 participants

@schell

It looks like Data.Typeable no longer exports Typeable1 so I added some CPP conditions to make Snap.Internal.Types compile. My changes may be naive - please check! But snap-core now builds and installs for me on ghc7.7.2013.11.06.

@hvr
Collaborator
hvr commented

I wonder why exactly the manual instance in 8ee59a2 was needed anyway... i.e. why couldn't hint handle the auto-derived one?

@gregorycollins

Hey @chowells79 -- is this the right thing to do here?

Would it be better to use #if __GLASGOW_HASKELL__ >= 707 ? It would achieve the same effect but wouldn't be effective for compiling with Hugs, me thinks.

Collaborator

Lots of stuff in snap isn't going to compile with things other than ghc. I think I'd use the __GLASGOW_HASKELL__ guard, since it's slightly easier to read. But either way, this is the right approach.

@phadej

I guess this can be closed as master compiles with ghc 7.8?

@gregorycollins

Yeah someone else added the required code IIRC -- but could you verify it's fixed and close this if so?

@phadej

It compiles with ghc-7.8.0.20140228 (rc2) for me. Couldn't test further as looks like that snap-server would require similar changes. And I cannot close other's PRs. :)

@schell

HEAD builds for me as well on ghc 7.8 rc2. Closing this PR.

@schell schell closed this
@schell schell deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 26, 2013
  1. @schell
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/Snap/Internal/Types.hs
View
9 src/Snap/Internal/Types.hs
@@ -143,10 +143,15 @@ data SnapResult a = SnapValue a
| EarlyTermination Response
------------------------------------------------------------------------------
+#if MIN_VERSION_base(4,7,0)
+newtype Snap a = Snap {
+ unSnap :: StateT SnapState (Iteratee ByteString IO) (SnapResult a)
+ } deriving (Typeable)
+#else
newtype Snap a = Snap {
unSnap :: StateT SnapState (Iteratee ByteString IO) (SnapResult a)
}
-
+#endif
------------------------------------------------------------------------------
data SnapState = SnapState
@@ -273,8 +278,10 @@ snapTyCon = mkTyCon "Snap.Core.Snap"
#endif
{-# NOINLINE snapTyCon #-}
+#if !MIN_VERSION_base(4,7,0)
instance Typeable1 Snap where
typeOf1 _ = mkTyConApp snapTyCon []
+#endif
------------------------------------------------------------------------------
Something went wrong with that request. Please try again.