1 {-# LANGUAGE FlexibleContexts #-}
2 {-# LANGUAGE FlexibleInstances #-}
4 {-# LANGUAGE MultiParamTypeClasses #-}
5 {-# LANGUAGE OverloadedStrings #-}
6 {-# LANGUAGE PatternSynonyms #-}
7 {-# LANGUAGE ScopedTypeVariables #-}
8 {-# LANGUAGE TypeFamilies #-}
9 {-# OPTIONS_GHC -fno-warn-orphans #-}
10 module Language.Symantic.Type.Map where
13 import Data.Map.Strict as Map
15 import Language.Symantic.Type.Common
19 type Type_Map = Type_Type2 (Proxy Map)
21 type instance Constraint2_of (Proxy Map)
24 {- FIXME: Could not deduce (Ord k) arising from a pattern…
26 :: Ord k => root k -> root a
27 -> Type_Type2 (Proxy Map) root (Map k a)
29 = Type_Type2 Proxy k a
32 -- ** Class 'Constraint2_Map'
33 class Constraint2_Map k a
34 instance Ord k => Constraint2_Map k a
36 instance -- String_from_Type
37 String_from_Type root =>
38 String_from_Type (Type_Map root) where
39 string_from_type (Type_Type2 _ k a) =
40 "Map (" ++ string_from_type k ++ ")"
41 ++ " (" ++ string_from_type a ++ ")"
43 -- | Inject 'Type_Map' within a root type.
45 :: forall root h_k h_a.
46 (Lift_Type_Root Type_Map root, Ord h_k)
47 => root h_k -> root h_a
49 type_map k a = lift_type_root (Type_Type2 Proxy k a
50 ::Type_Map root (Map h_k h_a))