New paste Repaste Download
{-# Language UndecidableInstances, DataKinds, DeriveGeneric, TypeFamilies #-}
module Z where
import GHC.Generics
import Data.Kind
import GHC.Exts
type family Field' (s :: Symbol) (f :: Type -> Type) :: Maybe Type where
  Field' s (D1 c f) = Field' s f
  Field' s (C1 c f) = Field' s f
  Field' s (S1 (MetaSel ('Just s) _ _ _) (K1 _ a)) = 'Just a
  Field' s (S1 (MetaSel _ _ _ _) _) = 'Nothing
  Field' s (f :*: g) = Or (Field' s f) (Field' s g)
type family Or a b where
  Or ('Just x) _ = 'Just x
  Or _ ('Just x) = 'Just x
  Or _ _ = 'Nothing
data Demo = Demo { marco :: Int, polo :: Char }
  deriving Generic
Filename: None. Size: 636b. View raw, , hex, or download this file.

This paste expires on 2024-11-21 00:17:35.906867. Pasted through web.