title: Dependent Types in Haskell
body: <p>The following does not work in Haskell-</p>
  <pre class="lang-hs prettyprint-override"><code>{-# LANGUAGE GADTs, DataKinds, TypeFamilies, UndecidableInstances,
               RankNTypes, PolyKinds #-}
  
  import Data.Kind
  
  data Payload :: (f :: a -&gt; Type) -&gt; (e :: a) -&gt; Type where
    MkPayload :: (e :: a) -&gt; (t :: f e) -&gt; Payload f e
  
  payload :: Payload f e -&gt; f e
  payload (MkPayload e t) = t
  </code></pre>
  <pre class="lang-none prettyprint-override"><code>    • Expecting one more argument to ‘f :: a -&gt; Type’
        Expected a type, but ‘f :: a -&gt; Type’ has kind ‘a -&gt; Type’
      • In the kind ‘(f :: a -&gt; Type) -&gt; (e :: a) -&gt; Type’
        In the data type declaration for ‘Payload’
    |
  6 | data Payload :: (f :: a -&gt; Type) -&gt; (e :: a) -&gt; Type where
    |                  ^^^^^^^^^^^^^^
  </code></pre>
  <p>Is there any other way someone can define dependent types in Haskell?</p>