type Bytes<static N: usize> {
    items: [N]u8,
    fn bytes(self: ref<Self>) -> [N]u8 {
        return self.items
    }
}

interface Sized<T: Type, static N: usize> {
    fn bytes(self: ref<T>) -> [N]u8
}

fn readSized<T: Sized<T, N>, static N: usize>(value: ref<T>) -> [N]u8 {
    return T.bytes(value)
}

fn readFour<T: Sized<T, 4>>(value: ref<T>) -> [4]u8 {
    return T.bytes(value)
}

pub fn main() -> Void {
    let bytes: Bytes<4> = Bytes { items: [1, 2, 3, 4] }
    let fromGeneric: [4]u8 = readSized<Bytes<4>, 4>(&bytes)
    let fromLiteral: [4]u8 = readFour<Bytes<4>>(&bytes)
    expect (fromGeneric[3] == 4 && fromLiteral[0] == 1)
}
