module Language.Lsd.ToMetaMap
    ( buildMetaMap
    )
where

import Data.Map (Map)
import Language.Lsd.AST.Common (FullTypeName)
import Language.Lsd.AST.Type
    ( NamedType
    , ProperTypeMeta
    , properTypeCollect'
    , properTypeMetaOf
    )
import Language.Lsd.AST.Type.DocumentContainer (DocumentContainerType)

-- | Derive a mapping from full typenames to type metadata, to be used by the
--   frontend.
buildMetaMap
    :: NamedType DocumentContainerType
    -> Map FullTypeName ProperTypeMeta
buildMetaMap :: NamedType DocumentContainerType -> Map FullTypeName ProperTypeMeta
buildMetaMap = (forall t'. ProperNodeKind t' => t' -> ProperTypeMeta)
-> NamedType DocumentContainerType
-> Map FullTypeName ProperTypeMeta
forall t v.
ProperNodeKind t =>
(forall t'. ProperNodeKind t' => t' -> v)
-> t -> Map FullTypeName v
properTypeCollect' t' -> ProperTypeMeta
forall t'. ProperNodeKind t' => t' -> ProperTypeMeta
properTypeMetaOf