feat: Read and Show for all the types

This commit is contained in:
vegowotenks 2025-08-12 14:22:59 +02:00
parent bf525c2dfd
commit fd715d99e0
9 changed files with 87 additions and 25 deletions

View file

@ -1,13 +1,27 @@
{-# LANGUAGE Safe #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE StandaloneKindSignatures #-} -- because of -Weverything
{-# LANGUAGE StandaloneDeriving #-} -- to specify contexts
{-# LANGUAGE FlexibleContexts #-} -- 'non type-variable argument'
{-# LANGUAGE UndecidableInstances #-} -- instance head no smaller...
module Language.Scalie.Ast.Module (Module(..)) where
import Data.Kind (Type)
import Language.Scalie.Ast.Definition (Definition)
import Data.Map.Implicit (ImplicitMap)
import Text.Show ( Show )
import Text.Read (Read)
import Data.Text (Text)
import Language.Scalie.Ast.Expression (Expression)
import Language.Scalie.Domain.Type qualified as Scalie.Domain
import Data.Ord (Ord)
-- | A module groups multiple related definitions.
type Module :: (Type -> Type) -> Type
type role Module nominal
data Module f = Module
{ definitions :: ImplicitMap (Definition f)
}
deriving stock instance (Show (f Text), Show (f Expression), Show (f Scalie.Domain.Type)) => Show (Module f)
deriving stock instance (Read (f Text), Ord (f Text), Read (f Expression), Read (f Scalie.Domain.Type)) => Read (Module f)