module Type.BST.Item (
Item(Item, value), type (|>)
, With
, newkey, item, (|>)
) where
import Type.BST.Proxy
import Type.BST.Showtype
newtype Item key a = Item {value :: a}
type With key = forall a. a -> Item key a
type (|>) = Item
instance (Showtype key, Show a) => Show (Item key a) where
showsPrec p (Item x) = showParen (p > 10) $
(\s -> "<" ++ showtype (Proxy :: Proxy key) ++ "> " ++ s) .
showsPrec 11 x
newkey :: Item key a -> proxy key' -> Item key' a
newkey (Item x) _ = Item x
item :: proxy key -> a -> Item key a
item _ = Item
(|>) :: proxy key -> a -> Item key a
(|>) = item
infixr 6 |>