Skip to content

Commit

Permalink
Make Sing and FromSing complete patterns (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
howtonotwin authored and RyanGlScott committed Jun 12, 2018
1 parent 44fdba3 commit bd71aed
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Data/Singletons/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class SingI a where
--
-- As a __pattern__: Matches on an explicit @Sing a@ witness bringing
-- an implicit @SingI a@ constraint into scope.
{-# COMPLETE Sing #-}
pattern Sing :: forall k (a :: k). () => SingI a => Sing a
pattern Sing <- (singInstance -> SingInstance)
where Sing = sing
Expand Down Expand Up @@ -137,6 +138,7 @@ data SomeSing k where
-- 'withSomeSing' bool2 $ \singBool2 ->
-- 'SomeSing' (singBool1 %&& singBool2)
-- @
{-# COMPLETE FromSing #-}
pattern FromSing :: SingKind k => forall (a :: k). Sing a -> Demote k
pattern FromSing sng <- ((\demotedVal -> withSomeSing demotedVal SomeSing) -> SomeSing sng)
where FromSing sng = fromSing sng
Expand Down

0 comments on commit bd71aed

Please sign in to comment.