Skip to content

Commit

Permalink
Merge pull request #427 from dmjio/mklink-fixes
Browse files Browse the repository at this point in the history
Add CPP for new MkLink
  • Loading branch information
dmjio authored Jul 5, 2018
2 parents 9428e28 + 2c42a78 commit 62a82e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ghc-src/Miso/Html/Internal.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions ghcjs-src/Miso/Html/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 62a82e2

Please sign in to comment.