ide-backend-common-0.10.0: Shared library used be ide-backend and ide-backend-server

Safe HaskellNone
LanguageHaskell2010

IdeSession.Types.Translation

Description

Translation from the private to the public types

Synopsis

Documentation

class (MShared (XShared a) ~ a, Binary (XShared a)) => ExplicitSharing a where Source

Many of the public data types that we export in IdeSession have a corresponding private XShared version. For instance, we have IdProp and XShared IdProp, SourceError and XShared SourceError, etc. These XShared types are abstract; what's important is only that they can be serialized (support FromJSON and ToJSON). The main difference between the public and the private data types is that the private data types use explicit sharing. This is important for serialization, because there is quite a bit of sharing in the type information that we collect and losing this would be a significant performance hit. (The other difference is that the private data types use specialized types that guarantee strictness.)

The MShared (XShared a) ~ a condition on the ExplicitSharing type class is there for technical reasons only (it convinces GHC that the XShared type family is a bijection).

class IntroduceSharing a where Source

Introduce explicit sharing

This provides the opposite translation to removeExplicitSharing. Note however that this is a partial function -- we never extend the cache, so if a required value is missing from the cache we return Nothing.

showNormalized :: forall a. (Show a, ExplicitSharing a, MShared (XShared a) ~ a) => Proxy a -> ExplicitSharingCache -> XShared a -> String Source