{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ViewPatterns #-}
module Covenant.Util
( pattern NilV,
pattern ConsV,
)
where
import Data.Kind (Type)
import Data.Vector.Generic (Vector)
import Data.Vector.Generic qualified as Vector
pattern NilV :: forall (a :: Type) (v :: Type -> Type). (Vector v a) => v a
pattern $bNilV :: forall a (v :: Type -> Type). Vector v a => v a
$mNilV :: forall {r} {a} {v :: Type -> Type}.
Vector v a =>
v a -> ((# #) -> r) -> ((# #) -> r) -> r
NilV <- (Vector.uncons -> Nothing)
where
NilV = v a
forall (v :: Type -> Type) a. Vector v a => v a
Vector.empty
pattern ConsV ::
forall (a :: Type) (v :: Type -> Type).
(Vector v a) =>
a ->
v a ->
v a
pattern $mConsV :: forall {r} {a} {v :: Type -> Type}.
Vector v a =>
v a -> (a -> v a -> r) -> ((# #) -> r) -> r
ConsV x xs <- (Vector.uncons -> Just (x, xs))
{-# COMPLETE NilV, ConsV #-}