Skip to content

GHC Lint: Out of scope

Haven't examined this, this is from an old ghc (8.10)ok.log so it may have been fixed.

{-# Language ConstraintKinds          #-}
{-# Language FlexibleContexts         #-}
{-# Language FlexibleInstances        #-}
{-# Language GADTs                    #-}
{-# Language ImpredicativeTypes       #-}
{-# Language InstanceSigs             #-}
{-# Language MultiParamTypeClasses    #-}
{-# Language PolyKinds                #-}
{-# Language PolyKinds                #-}
{-# Language PolyKinds                #-}
{-# Language QuantifiedConstraints    #-}
{-# Language ScopedTypeVariables      #-}
{-# Language StandaloneKindSignatures #-}
{-# Language TypeApplications         #-}
{-# Language TypeFamilies             #-}

{-# Options_GHC -dcore-lint #-}

import Data.Kind
import Data.Coerce
import Data.Type.Coercion
import GHC.Generics

data Dict cls where
 Dict :: cls => Dict cls

type    ViaRep :: Type -> (k -> Type) -> Type
newtype a `ViaRep` rep = ViaRep a

class    Coercible (Rep a x) (rep x) => AuxCoercible a rep x
instance Coercible (Rep a x) (rep x) => AuxCoercible a rep x

type ForallAuxCoercible a rep = forall x. AuxCoercible a rep x

instance (Generic a, ForallAuxCoercible a rep) => Generic (ViaRep a rep) where
 type Rep (ViaRep a rep) = rep

 from :: forall x. ViaRep a rep -> rep x
 from (ViaRep a) = co undefined (from @a @x a) where -- coerce (from @a @x a) where

  co :: Coercion (Rep a x) (rep x) -> Rep a x -> rep x
  co = undefined

  c :: Dict (ForallAuxCoercible a rep)
  c = Dict
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information