{-# LANGUAGE DataKinds, TypeFamilies, PatternSynonyms #-}
module A
where

import Data.Coerce (coerce)

data State = A | B | C

type family Foo (s :: State) where
    Foo 'A = String
    Foo 'B = [Int]
    Foo 'C = String

newtype Bar (s :: State) = Bar' (Baz (Foo s))

data Baz a = Baz {
    _x :: Int,
    _y :: a
}

pattern Bar{x, y} = Bar' ( Baz { _x = x, _y = y } )
