------------------------------------------------------------------------
-- The Agda standard library
--
-- An effectful view of Colist
------------------------------------------------------------------------

{-# OPTIONS --cubical-compatible --sized-types #-}

module Codata.Sized.Colist.Effectful where

open import Codata.Sized.Conat using (infinity)
open import Codata.Sized.Colist
open import Effect.Choice
open import Effect.Empty
open import Effect.Functor
open import Effect.Applicative

functor :  { i}  RawFunctor {}  A  Colist A i)
functor = record { _<$>_ = map }

applicative :  { i}  RawApplicative {}  A  Colist A i)
applicative = record
  { rawFunctor = functor
  ; pure = replicate infinity
  ; _<*>_  = ap
  }

empty :   { i}  RawEmpty {}  A  Colist A i)
empty = record { empty = [] }

choice :   { i}  RawChoice {}  A  Colist A i)
choice = record { _<|>_ = _++_ }

applicativeZero :  { i}  RawApplicativeZero {}  A  Colist A i)
applicativeZero = record
  { rawApplicative = applicative
  ; rawEmpty = empty
  }

alternative :  { i}  RawAlternative {}  A  Colist A i)
alternative = record
  { rawApplicativeZero = applicativeZero
  ; rawChoice = choice
  }