mirror of
https://github.com/anoma/juvix.git
synced 2025-01-08 08:39:26 +03:00
parent
76d69b5ef3
commit
6b38543ae3
@ -82,9 +82,10 @@ paramToExpression = \case
|
|||||||
_instanceAppExpression
|
_instanceAppExpression
|
||||||
InstanceParamFun InstanceFun {..} ->
|
InstanceParamFun InstanceFun {..} ->
|
||||||
_instanceFunExpression
|
_instanceFunExpression
|
||||||
InstanceParamHole h -> ExpressionHole h
|
InstanceParamHole h ->
|
||||||
InstanceParamMeta {} ->
|
ExpressionHole h
|
||||||
impossible
|
InstanceParamMeta v ->
|
||||||
|
ExpressionIden (IdenVar v)
|
||||||
|
|
||||||
paramFromExpression :: HashSet VarName -> Expression -> Maybe InstanceParam
|
paramFromExpression :: HashSet VarName -> Expression -> Maybe InstanceParam
|
||||||
paramFromExpression metaVars e = case e of
|
paramFromExpression metaVars e = case e of
|
||||||
|
@ -27,6 +27,9 @@ checkStrictSubterm :: InstanceParam -> InstanceParam -> Bool
|
|||||||
checkStrictSubterm p1 p2 = case p2 of
|
checkStrictSubterm p1 p2 = case p2 of
|
||||||
InstanceParamApp InstanceApp {..} ->
|
InstanceParamApp InstanceApp {..} ->
|
||||||
any (checkSubterm p1) _instanceAppArgs
|
any (checkSubterm p1) _instanceAppArgs
|
||||||
|
InstanceParamFun InstanceFun {..} ->
|
||||||
|
checkSubterm p1 _instanceFunLeft
|
||||||
|
|| checkSubterm p1 _instanceFunRight
|
||||||
_ ->
|
_ ->
|
||||||
False
|
False
|
||||||
|
|
||||||
|
@ -66,6 +66,15 @@ instance
|
|||||||
showPairI {A B} {{Show A}} {{Show B}} : Show (A × B) :=
|
showPairI {A B} {{Show A}} {{Show B}} : Show (A × B) :=
|
||||||
mkShow λ {(x, y) := Show.show x ++str ", " ++str Show.show y};
|
mkShow λ {(x, y) := Show.show x ++str ", " ++str Show.show y};
|
||||||
|
|
||||||
|
trait
|
||||||
|
type T A := mkT { a : A };
|
||||||
|
|
||||||
|
instance
|
||||||
|
tNatI : T Nat := mkT 0;
|
||||||
|
|
||||||
|
instance
|
||||||
|
tFunI {A} {{T A}} : T (A -> A) := mkT \ { a := a };
|
||||||
|
|
||||||
main : IO :=
|
main : IO :=
|
||||||
printStringLn (Show.show true) >>
|
printStringLn (Show.show true) >>
|
||||||
printStringLn (f false) >>
|
printStringLn (f false) >>
|
||||||
@ -82,4 +91,4 @@ main : IO :=
|
|||||||
printStringLn (f5 "abba" 3) >>
|
printStringLn (f5 "abba" 3) >>
|
||||||
printStringLn (Show.show {{_}} ["a"; "b"; "c"; "d"]) >>
|
printStringLn (Show.show {{_}} ["a"; "b"; "c"; "d"]) >>
|
||||||
printStringLn (Show.show (λ{x := not x})) >>
|
printStringLn (Show.show (λ{x := not x})) >>
|
||||||
printStringLn (Show.show (3, [1; 2]));
|
printStringLn (Show.show (3, [1; 2 + T.a 0]));
|
||||||
|
Loading…
Reference in New Issue
Block a user