summaryrefslogtreecommitdiff
path: root/src/Data/Sized.hs
blob: 0d3d5845ce4e43c8cadafdd2c96968fa3324c338 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Data.Sized where

import Data.Typeable


-- | Info about a type's serialized length. Either the length is known
-- independently of the value, or the length depends on the value.
data Size a
    = VarSize (a -> Int)
    | ConstSize !Int
    deriving Typeable

class Sized a where size :: Size a