summaryrefslogtreecommitdiff
path: root/src/Interpreter/Rep.hs
blob: 1ded7735dbded47e58e027a0b60449dc4bdbfd10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
module Interpreter.Rep where

import GHC.TypeError

import Array
import AST


type family Rep t where
  Rep TNil = ()
  Rep (TPair a b) = (Rep a, Rep b)
  Rep (TEither a b) = Either (Rep a) (Rep b)
  Rep (TArr n t) = Array n (Rep t)
  Rep (TScal sty) = ScalRep sty
  Rep (TAccum t) = TypeError (Text "Accumulator in Rep")