From 2c42a78b5827d71fd40db8efd560a12e79ce6a28 Mon Sep 17 00:00:00 2001 From: David Johnson Date: Wed, 4 Jul 2018 17:02:45 -0400 Subject: [PATCH] Add CPP for new MkLink --- ghc-src/Miso/Html/Internal.hs | 9 ++++++++- ghcjs-src/Miso/Html/Internal.hs | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ghc-src/Miso/Html/Internal.hs b/ghc-src/Miso/Html/Internal.hs index 838194c3..55187489 100644 --- a/ghc-src/Miso/Html/Internal.hs +++ b/ghc-src/Miso/Html/Internal.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE DataKinds #-} @@ -123,8 +124,14 @@ newtype View action = View { runView :: VTree action } -- | For constructing type-safe links instance HasLink (View a) where +#if MIN_VERSION_servant(0,14,0) + type MkLink (View a) b = MkLink (Get '[] ()) b + toLink Proxy toA = toLink toA (Proxy :: Proxy (Get '[] ())) +#else type MkLink (View a) = MkLink (Get '[] ()) - toLink _ = toLink (Proxy :: Proxy (Get '[] ())) + toLink Proxy = toLink (Proxy :: Proxy (Get '[] ())) +#endif + -- | Convenience class for using View class ToView v where toView :: v -> View action diff --git a/ghcjs-src/Miso/Html/Internal.hs b/ghcjs-src/Miso/Html/Internal.hs index 37d63dce..17e5802a 100644 --- a/ghcjs-src/Miso/Html/Internal.hs +++ b/ghcjs-src/Miso/Html/Internal.hs @@ -90,8 +90,13 @@ newtype View action = View { -- | For constructing type-safe links instance HasLink (View a) where +#if MIN_VERSION_servant(0,14,0) + type MkLink (View a) b = MkLink (Get '[] ()) b + toLink toA Proxy = toLink toA (Proxy :: Proxy (Get '[] ())) +#else type MkLink (View a) = MkLink (Get '[] ()) toLink _ = toLink (Proxy :: Proxy (Get '[] ())) +#endif -- | Convenience class for using View class ToView v where toView :: v -> View m