Derivatives for Containers in Univalent Foundations
Agda.Builtin.List
Initializing search
    phijor/derivatives
    • Overview
    • Library
    phijor/derivatives
    • Overview
      • Derivative.Bag
      • Derivative.Adjunction
      • Derivative.Basics.Sum
      • Derivative.Basics.Unit
      • Derivative.Basics.W
      • Derivative.Basics.Decidable
      • Derivative.Basics.Embedding
      • Derivative.Basics.Equiv
      • Derivative.Basics.Maybe
      • Derivative.Basics.Sigma
      • Derivative.Category
      • Derivative.ChainRule
      • Derivative.Container
      • Derivative.Derivative
      • Derivative.Indexed.Mu
      • Derivative.Indexed.ChainRule
      • Derivative.Indexed.Container
      • Derivative.Indexed.Derivative
      • Derivative.Indexed.MuRule
      • Derivative.Indexed.Univalence
      • Derivative.Isolated.Base
      • Derivative.Isolated
      • Derivative.Isolated.S1
      • Derivative.Isolated.Sum
      • Derivative.Isolated.W
      • Derivative.Isolated.DependentGrafting
      • Derivative.Isolated.Grafting
      • Derivative.Isolated.Maybe
      • Derivative.Isolated.Sigma
      • Derivative.Prelude
      • Derivative.Properties
      • Derivative.Remove

    Agda.Builtin.List

    {-# OPTIONS --cubical-compatible --safe --no-sized-types --no-guardedness --level-universe #-}
    
    module Agda.Builtin.List where
    
    infixr 5 _∷_
    data List {a} (A : Set a) : Set a where
      []  : List A
      _∷_ : (x : A) (xs : List A) → List A
    
    {-# BUILTIN LIST List #-}
    
    {-# COMPILE JS  List = function(x,v) {
      if (x.length < 1) { return v["[]"](); } else { return v["_∷_"](x[0], x.slice(1)); }
    } #-}
    {-# COMPILE JS [] = Array() #-}
    {-# COMPILE JS _∷_ = function (x) { return function(y) { return Array(x).concat(y); }; } #-}
    
    Made with Material for MkDocs