mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-19 09:12:34 +03:00
129 lines
3.3 KiB
Plaintext
129 lines
3.3 KiB
Plaintext
1/1: Building TypePat (TypePat.idr)
|
|
Main> Main.isNat
|
|
Arguments [{arg:0}]
|
|
Compile time tree: case {arg:0} of
|
|
Nat => True
|
|
_ => False
|
|
Compiled: \ {arg:0} => case {arg:0} of
|
|
{ Prelude.Types.Nat [tycon] => 1
|
|
; _ => 0
|
|
}
|
|
Refers to: Prelude.Basics.True, Prelude.Basics.False
|
|
Refers to (runtime): Prelude.Types.Nat
|
|
Flags: allguarded, covering
|
|
Size change:
|
|
Prelude.Basics.True:
|
|
l
|
|
r +
|
|
Prelude.Basics.False:
|
|
l
|
|
r +
|
|
Main> Main.isInt32
|
|
Arguments [{arg:0}]
|
|
Compile time tree: case {arg:0} of
|
|
Int32 => True
|
|
_ => False
|
|
Compiled: \ {arg:0} => case {arg:0} of
|
|
{ Int32 [tycon] => 1
|
|
; _ => 0
|
|
}
|
|
Refers to: Prelude.Basics.True, Prelude.Basics.False
|
|
Refers to (runtime): Int32
|
|
Flags: allguarded, covering
|
|
Size change:
|
|
Prelude.Basics.True:
|
|
l
|
|
r +
|
|
Prelude.Basics.False:
|
|
l
|
|
r +
|
|
Main> Prelude.Types.plus
|
|
Arguments [{arg:0}, {arg:1}]
|
|
Compile time tree: case {arg:0} of
|
|
Z => {arg:1}
|
|
S {e:0} => S (plus {e:0} {arg:1})
|
|
Compiled: \ {arg:0}, {arg:1} => case {arg:0} of
|
|
{ 0 => {arg:1}
|
|
; _ => let {e:0} = {arg:0} - 1 in
|
|
({e:0} + {arg:1}) + 1
|
|
}
|
|
Refers to: Prelude.Types.plus, Prelude.Types.S
|
|
Flags: total
|
|
Size change:
|
|
Prelude.Types.S:
|
|
l
|
|
r +
|
|
Prelude.Types.plus:
|
|
l 0 1
|
|
r +----
|
|
0 | <
|
|
1 | =
|
|
Main> Prelude.Types.minus
|
|
Arguments [{arg:0}, {arg:1}]
|
|
Compile time tree: case {arg:0} of
|
|
Z => 0
|
|
_ => case {arg:1} of
|
|
Z => {arg:0}
|
|
_ => case {arg:0} of
|
|
S {e:0} => case {arg:1} of
|
|
S {e:1} => minus {e:0} {e:1}
|
|
Compiled: \ {arg:0}, {arg:1} => case {arg:0} of
|
|
{ 0 => 0
|
|
; _ => case {arg:1} of
|
|
{ 0 => {arg:0}
|
|
; _ => case {arg:0} of
|
|
{ 0 => crash "Nat case not covered"
|
|
; _ => let {e:0} = {arg:0} - 1 in
|
|
case {arg:1} of
|
|
{ 0 => crash "Nat case not covered"
|
|
; _ => let {e:1} = {arg:1} - 1 in
|
|
Prelude.Types.prim__integerToNat ({e:0} - {e:1})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Refers to: Prelude.Types.minus, Prelude.Types.Z
|
|
Refers to (runtime): Prelude.Types.prim__integerToNat
|
|
Flags: total
|
|
Size change:
|
|
Prelude.Types.Z:
|
|
l
|
|
r +
|
|
Prelude.Types.minus:
|
|
l 0 1
|
|
r +----
|
|
0 | <
|
|
1 | <
|
|
Main> Prelude.Types.SnocList.filter
|
|
Arguments [{arg:0}, {arg:1}, {arg:2}]
|
|
Compile time tree: case {arg:2} of
|
|
Lin {e:0} => [<]
|
|
(:<) {e:1} {e:2} {e:3} => let rest = filter {arg:1} {e:2} in if {arg:1} {e:3} then rest :< {e:3} else rest
|
|
Erasable args: [0]
|
|
Inferrable args: [0]
|
|
Compiled: \ {arg:1}, {arg:2} => case {arg:2} of
|
|
{ Prelude.Basics.Lin {tag = 0} [nil] => Prelude.Basics.Lin {tag = 0} [nil]
|
|
; Prelude.Basics.(:<) {tag = 1} [cons] {e:2} {e:3} => let rest = Prelude.Types.SnocList.filter {arg:1} {e:2} incase {arg:1} {e:3} of { 1 => Prelude.Basics.(:<) {tag = 1} [cons] rest {e:3}; 0 => rest}
|
|
}
|
|
Refers to: Prelude.Basics.SnocList, Prelude.Basics.Lin, Prelude.Types.SnocList.case block in filter, Prelude.Types.SnocList.filter
|
|
Refers to (runtime): Prelude.Basics.Lin, Prelude.Basics.(:<), Prelude.Types.SnocList.filter
|
|
Flags: total
|
|
Size change:
|
|
Prelude.Basics.Lin:
|
|
l 0 1 2
|
|
r +------
|
|
0 | = <
|
|
Prelude.Types.SnocList.filter:
|
|
l 0 1 2
|
|
r +------
|
|
0 | = <
|
|
1 | =
|
|
2 | <
|
|
Prelude.Basics.(:<):
|
|
l 0 1 2
|
|
r +------
|
|
0 | = <
|
|
2 | <
|
|
Main>
|
|
Bye for now!
|