Skip to content

Instantly share code, notes, and snippets.

@NathanHowell
Created April 21, 2016 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NathanHowell/2c5158ed54b3813eb84e06c97268ca5e to your computer and use it in GitHub Desktop.
Save NathanHowell/2c5158ed54b3813eb84e06c97268ca5e to your computer and use it in GitHub Desktop.
instance (a ~ Proxy "Sum types are not supported by LLVM") => GGetElementIndex a (x :+: y) where
type GGetElementPtrType a (x :+: y) = Void
ggetElementIndex _ _ = error "Sum types are not supported by LLVM"
type family StructElement (a :: [*]) (n :: Nat) :: * where
StructElement (x ': xs) 0 = x
StructElement (x ': xs) n = StructElement xs (n - 1)
StructElement '[] n = Proxy "Attempting to index past end of structure"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment