module Data.Capnp where

-- | A 'Get' is a wrapper around a @get_*@ function for a field. This is
-- intended to be used with the OverloadedLabels extension, like
-- @'get' #myField struct@. The newtype wrapper and 'get' function allow
-- us to disambiguate between different uses of @#myField@.
newtype Get m parent child = Get { get :: parent -> m child }

-- | Like 'Get', but wraps a @has_*@ function instead of a @get_*@ function.
newtype Has m parent = Has { has :: parent -> m Bool }

-- | Like 'Get', but wraps a @set_*@ function instead of a @get_*@ function.
newtype Set m parent child = Set { set :: parent -> child -> m () }

-- | Like 'Get', but wraps a @new_*@ function instead of a @get_*@ function.
newtype New m parent child = New { new :: parent -> m child }

module Data.Capnp where

-- | A 'Get' is a wrapper around a @get_*@ function for a field. This is
-- intended to be used with the OverloadedLabels extension, like
-- @'get' #myField struct@. The newtype wrapper and 'get' function allow
-- us to disambiguate between different uses of @#myField@.
newtype Get m parent child = Get { get :: parent -> m child }

-- | Like 'Get', but wraps a @has_*@ function instead of a @get_*@ function.
newtype Has m parent = Has { has :: parent -> m Bool }

-- | Like 'Get', but wraps a @set_*@ function instead of a @get_*@ function.
newtype Set m parent child = Set { set :: parent -> child -> m () }

-- | Like 'Get', but wraps a @new_*@ function instead of a @get_*@ function.
newtype New m parent child info = New { new :: parent -> info -> m child }

Add an extra 'info' type parameter to New.
Add an extra 'info' type parameter to New.

At least new_ for list types will need this, to specify the length.
We'll set it to '()' for types that don't need it.
