diff --git a/src/Language/Scalie/Core/Definition.hs b/src/Language/Scalie/Core/Definition.hs index c1f0f60..60e2cb8 100644 --- a/src/Language/Scalie/Core/Definition.hs +++ b/src/Language/Scalie/Core/Definition.hs @@ -60,6 +60,8 @@ deriving stock instance (Show (f (Expression f)), Show (f Scalie.Domain.Type), S deriving stock instance (Read (f (Expression f)), Read (f Scalie.Domain.Type), Read (f Text)) => Read (Definition f) deriving stock instance (Eq (f (Expression f)), Eq (f Scalie.Domain.Type) , Eq (f Text)) => Eq (Definition f) +-- | Using custom instances allows extracting just the text whereever possible. + instance ImplicitKeyOf (Definition (Provenance a)) where type KeyType (Definition (Provenance a)) = Text keyOf :: Definition (Provenance a) -> KeyType (Definition (Provenance a)) diff --git a/src/Language/Scalie/Core/Expression.hs b/src/Language/Scalie/Core/Expression.hs index 3c84c15..6511fb7 100644 --- a/src/Language/Scalie/Core/Expression.hs +++ b/src/Language/Scalie/Core/Expression.hs @@ -24,6 +24,8 @@ import Test.QuickCheck.Gen (Gen) import Test.QuickCheck qualified as Gen +-- | Desugared expression. + type Expression :: (Type -> Type) -> Type type role Expression nominal data Expression f diff --git a/src/Language/Scalie/Core/Module.hs b/src/Language/Scalie/Core/Module.hs index 0a0ce69..b344fa7 100644 --- a/src/Language/Scalie/Core/Module.hs +++ b/src/Language/Scalie/Core/Module.hs @@ -9,7 +9,7 @@ import Data.Kind (Type) import Language.Scalie.Core.Definition (Definition) import Data.Map.Implicit (ImplicitMap) --- | A module groups multiple related definitions. +-- | A module groups multiple related variable definitions. -- -- >>> import Data.Functor.Identity (Identity(..)) -- >>> import Data.Map.Implicit qualified as ImplicitMap diff --git a/src/Language/Scalie/Core/Provenance.hs b/src/Language/Scalie/Core/Provenance.hs index d067c69..50714c7 100644 --- a/src/Language/Scalie/Core/Provenance.hs +++ b/src/Language/Scalie/Core/Provenance.hs @@ -11,6 +11,8 @@ import Data.Bifunctor (Bifunctor (bimap)) import Data.Bifoldable (Bifoldable (bifoldMap)) import Data.Bitraversable (Bitraversable (bitraverse)) +-- | Provenance records where something comes from. E.g. file name, file line, other sources. + type Provenance :: Type -> Type -> Type type role Provenance representational representational data Provenance source value = Provenance diff --git a/src/Language/Scalie/Core/Provenance/SourceLocation.hs b/src/Language/Scalie/Core/Provenance/SourceLocation.hs index 301b1e2..3ecf436 100644 --- a/src/Language/Scalie/Core/Provenance/SourceLocation.hs +++ b/src/Language/Scalie/Core/Provenance/SourceLocation.hs @@ -2,6 +2,10 @@ module Language.Scalie.Core.Provenance.SourceLocation (SourceLocation(..)) where import Data.Kind (Type) +-- | Location of anything in a user-provided source file. +-- +-- TODO: Add more constructors + type SourceLocation :: Type data SourceLocation = Synthesized diff --git a/src/Language/Scalie/Domain/Type.hs b/src/Language/Scalie/Domain/Type.hs index 106c061..97354de 100644 --- a/src/Language/Scalie/Domain/Type.hs +++ b/src/Language/Scalie/Domain/Type.hs @@ -12,6 +12,8 @@ data Type = RawInt deriving stock (Show, Read, Eq) + -- add to the arbitrary instance when defining constructors + instance Arbitrary Type where arbitrary :: Gen Type arbitrary = oneof [ pure RawInt ]