Near to minimal example for "Var/Type length mismatch" GHC bug

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{-# LANGUAGE EmptyDataDecls, GADTs, TypeFamilies #-}

data Credit
data Debit

data Posting t where
  Posting :: {
    debitPostingAccount :: Account Locked Debit
  } -> Posting Debit

data Locked
data Unlocked

data family Account s t

data instance Account Locked t = LockedAccount {
    accountContent :: (Account Unlocked t) }

data instance Account Unlocked t where
  CAccount :: {
    creditAccountPostings :: [Posting Credit]
  } -> Account Unlocked Credit

  DAccount :: {
    debitAccountPostings :: [Posting Debit]
  } -> Account Unlocked Debit

main = print "Hello"