{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} module Language.Symantic.Type.Map where import Data.Proxy import Data.Map.Strict as Map import Language.Symantic.Type.Common -- * Type 'Type_Map' -- | The 'Map' type. type Type_Map = Type_Type2 Constraint2_Map Map pattern Type_Map arg res = Type_Type2 Proxy Proxy arg res -- ** Class 'Constraint2_Map' class Constraint2_Map k a instance Ord k => Constraint2_Map k a instance -- String_from_Type String_from_Type root => String_from_Type (Type_Map root) where string_from_type (Type_Type2 _ _ k a) = "Map (" ++ string_from_type k ++ ")" ++ " (" ++ string_from_type a ++ ")" -- | Convenient alias to include a 'Type_Map' within a type. type_map :: forall root h_k h_a. (Lift_Type_Root Type_Map root, Ord h_k) => root h_k -> root h_a -> root (Map h_k h_a) type_map k a = lift_type_root (Type_Map k a ::Type_Map root (Map h_k h_a))