1
1
mirror of https://github.com/thma/LtuPatternFactory.git synced 2024-12-02 08:33:20 +03:00

Update Coerce.hs

This commit is contained in:
thma 2018-11-15 17:53:12 +01:00 committed by GitHub
parent acfa7ec1c2
commit 0528368266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ import Control.Monad.State.Lazy -- State Monad
import Data.Typeable
-- | This module provides explicit coercion.
-- Just in case you want to know what's behind the "magic" Data.Coerce.coerce
-- Instead of the "magic" Data.Coerce.coerce you could use wrap and unwrap to explicitely write the coercions.
class Coerce a b | a -> b where
unwrap :: a -> b
wrap :: b -> a
@ -40,14 +40,3 @@ instance Coerce (m a) c => Coerce (WrappedMonad m a) c where
instance Coerce (State s a) (s -> (a,s)) where
unwrap = runState
wrap = state
coerce :: (Coerce a b, Coerce b a, Typeable a, Typeable b) => a -> b
coerce = undefined
{--
coerce x = let u = wrap x
d = unwrap x
--ta = typeRep ([] :: [a])
tb = typeRep ([] :: [b])
in if (typeOf u == tb) then u
else d
--}