ermine-0.6: Ermine

Copyright(c) Edward Kmett and Dan Doel 2013-2014
LicenseBSD3
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Ermine.Syntax.Head

Description

 

Synopsis

Documentation

data Head Source

In the instance declaration:

  instance Foo a => Bar Int [a] where
    ...

The portion Bar Int [a] is the head of the instance. All instances must have a unique head; type class dispatch does not take the context of the instance into account. Thus, instances are uniquely identified by their heads, and we use them for that purpose among others.

The Head type records all the information necessary for this unique identification, plus a hash for fast equality checks.

The above instance head would be represented as something like:

  Head ... Bar 0 [star] [] [int, list (B 0)]

Constructors

Head 

Fields

_headDigest :: ByteString
 
_hash :: !Int
 
_headClass :: !Global

The class name for which this is an instance

_headBoundKinds :: !Int

number of kind variables brought into scope

_headBoundTypes :: [Kind Int]

kinds of type variables brought into scope

_headKindArgs :: [Kind Int]
 
_headTypeArgs :: [Type Int Int]
 

class HasHead t where Source

Minimal complete definition

head_

Methods

head_ :: Lens' t Head Source

headClass :: Lens' t Global Source

headBoundKinds :: Lens' t Int Source

headBoundTypes :: Lens' t [Kind Int] Source

headKindArgs :: Lens' t [Kind Int] Source

headTypeArgs :: Lens' t [Type Int Int] Source

Instances

mkHead :: Global -> Int -> [Kind Int] -> [Kind Int] -> [Type Int Int] -> Head Source