{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE DataKinds #-}

-- | Rebindable syntax for Variant
module Haskus.Utils.Variant.Syntax
   ( (>>=)
   , (>>)
   , return
   )
where

import Haskus.Utils.Variant
import Haskus.Utils.Types

import Prelude hiding ((>>=),(>>),return)

(>>=) :: forall x xs ys. 
   ( KnownNat (Length ys)
   ) => V (x ': xs) -> (x -> V ys) -> V (Concat ys xs)
>>= :: forall x (xs :: [*]) (ys :: [*]).
KnownNat (Length ys) =>
V (x : xs) -> (x -> V ys) -> V (Concat ys xs)
(>>=) = V (x : xs) -> (x -> V ys) -> V (Concat ys xs)
forall x (xs :: [*]) (ys :: [*]).
KnownNat (Length ys) =>
V (x : xs) -> (x -> V ys) -> V (Concat ys xs)
bindVariant

(>>) :: V xs -> V ys -> V (Concat ys xs)
>> :: forall (xs :: [*]) (ys :: [*]). V xs -> V ys -> V (Concat ys xs)
(>>) = V xs -> V ys -> V (Concat ys xs)
forall (xs :: [*]) (ys :: [*]). V xs -> V ys -> V (Concat ys xs)
constBindVariant

return :: x -> V '[x]
return :: forall x. x -> V '[x]
return = x -> V '[x]
forall x. x -> V '[x]
variantFromValue