Skip to content

Commit

Permalink
add note that SWCoercibly incurs UndecInsts
Browse files Browse the repository at this point in the history
  • Loading branch information
raehik committed Oct 17, 2024
1 parent f783d16 commit 5d03bda
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/Strongweak/Weaken.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,24 @@ type family WeakenedN (n :: Natural) a :: Type where
WeakenedN 0 a = a
WeakenedN n a = Weakened (WeakenedN (n-1) a)

-- | A "via type" newtype for defining strongweak instances for zero-invariant,
-- coercible newtypes.
--
-- Use like so:
--
-- @
-- deriving via 'SWCoercibly' a instance 'Weaken' ('Identity' a)
-- @
{- | A "via type" newtype for defining strongweak instances for zero-invariant,
coercible newtypes.
Use like so:
@
deriving 'Weaken' via 'SWCoercibly' a
@
Or standalone:
@
via 'SWCoercibly' a instance 'Weaken' ('Identity' a)
@
Note that usage of this incurs UndecidableInstances. That's life. You can
write the trivial instances this generates yourself if you so wish
-}
newtype SWCoercibly a = SWCoercibly { unSWCoercibly :: a }
instance Weaken (SWCoercibly a) where
type Weakened (SWCoercibly a) = a
Expand Down

0 comments on commit 5d03bda

Please sign in to comment.