Last active
June 23, 2021 11:09
-
-
Save chisui/7b558c2d63e3a7fcffc67ae714b69714 to your computer and use it in GitHub Desktop.
user-specified instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src/Some.hs:17:16-77: error: | |
• Class ‘Typeable’ does not support user-specified instances | |
• In the quantified constraint ‘forall x. c x => Typeable x’ | |
In the type signature: | |
extractSome :: (Typeable a, forall x. c x => Typeable x) => | |
Some c -> Maybe a | |
| | |
26 | extractSome :: (Typeable a, forall x. c x => Typeable x) => Some c -> Maybe a | |
| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE QuantifiedConstraints #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
module Some where | |
import Data.Typeable | |
import Data.Kind | |
data Some c where | |
Some :: c a => a -> Some c | |
extractSome :: (Typeable a, forall x. c x => Typeable x) => Some c -> Maybe a | |
extractSome (Some a) = cast a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment