From a38a20a54653d3c43c857db36c9127e5651a361a Mon Sep 17 00:00:00 2001 From: VegOwOtenks Date: Fri, 15 Aug 2025 18:00:51 +0200 Subject: [PATCH] doc[core/expression]: constructor fields --- src/Language/Scalie/Core/Expression.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Language/Scalie/Core/Expression.hs b/src/Language/Scalie/Core/Expression.hs index 6511fb7..96e5bdf 100644 --- a/src/Language/Scalie/Core/Expression.hs +++ b/src/Language/Scalie/Core/Expression.hs @@ -29,17 +29,18 @@ import Test.QuickCheck qualified as Gen type Expression :: (Type -> Type) -> Type type role Expression nominal data Expression f - = RawInt (f Integer) - | RawRational (f Rational) - | RawString (f Text) - | PatternMatch (f (NonEmpty (PatternMatchCase f))) - | Lambda (f VariableIdentifier) (f (Expression f)) + = RawInt (f Integer) -- ^ e.g.: 42 + | RawRational (f Rational) -- ^ e.g.: 0.3000000000002 + | RawString (f Text) -- ^ raw text + | PatternMatch (f (NonEmpty (PatternMatchCase f))) -- ^ cases + | Lambda (f VariableIdentifier) (f (Expression f)) -- ^ argument name, calculation + | Apply (f (Expression f)) (f (Expression f)) -- ^ function, argument -- to me, this looks incredibly dangerous, because of Show (f (Expression f)) => Show (Expression f) -- let's hope UndecidableInstances won't have the compiler diverge deriving stock instance (Show (f Integer), Show (f Rational), Show (f Text), Show (f (NonEmpty (PatternMatchCase f))), Show (f VariableIdentifier), Show (f (Expression f))) => Show (Expression f) deriving stock instance (Read (f Integer), Read (f Rational), Read (f Text), Read (f (NonEmpty (PatternMatchCase f))), Read (f VariableIdentifier), Read (f (Expression f))) => Read (Expression f) -deriving stock instance (Eq (f Integer), Eq (f Rational), Eq (f Text), Eq (f (NonEmpty (PatternMatchCase f))), Eq (f VariableIdentifier), Eq (f (Expression f))) => Eq (Expression f) +deriving stock instance (Eq (f Integer), Eq (f Rational), Eq (f Text), Eq (f (NonEmpty (PatternMatchCase f))), Eq (f VariableIdentifier), Eq (f (Expression f))) => Eq (Expression f) instance (Arbitrary (f Integer), Arbitrary (f Rational), Arbitrary (f UnicodeString), Functor f, Arbitrary (f (Expression f)), Arbitrary (f VariableIdentifier), Arbitrary (f (NonEmptyList (PatternMatchCase f))) ) => Arbitrary (Expression f) where arbitrary :: Gen (Expression f)