Skip to content

Language record

Haskell

Haskell is indexed with instance resolution treated as a first-class question: an instance's methods are matched against the class it implements and published as overrides, while a data type carries its constructors — GADT constructors included — and its record fields.

.hs, .lhs · 1 registry id · 12 of 14 relationship types

The registry row this page is generated from

Read at render time from the same family row the register reads, so nothing in this block can disagree with it.

Extensions
.hs, .lhs
Registry names
haskell
Recorded symbols
modules · type classes · data types

Relationship types this analyzer constructs

12 of 14 constructed, read from this analyzer's source and re-derived by the languages gate. Each row below is one of the engine's types, in the engine's own order.

Relationship typeConstructed
callsconstructed by this analyzer
extendsconstructed by this analyzer
implementsconstructed by this analyzer
usesconstructed by this analyzer
importsconstructed by this analyzer
exportsconstructed by this analyzer
containsconstructed by this analyzer
referencesconstructed by this analyzer
overridesconstructed by this analyzer
instantiatesconstructed by this analyzer
decoratesconstructed by this analyzer
rendersruled absent
mixes_inruled absent
part_ofconstructed by this analyzer

12 constructed, 2 not constructed. All 2 absent types are recorded as ruled absent: the written reason and the corpus measurement behind each are in this family's completeness record. The register explains what each label means.

What this analyzer does not resolve

  • A local call resolves only against names this module declares: an imported function, a Prelude name and a parameter all produce no edge, because nothing in the file says which one was meant. Forward references, self-recursion and mutual recursion inside the module do resolve.
  • An instance method the class does not declare is not published as an override — the graph would be asserting a contract that does not exist in the source.
  • Template Haskell is not read, so a splice's generated declarations are invisible and a module's recorded surface can be smaller than what the compiler actually exports.

Every line above was written against Haskell’s own analyzer module and is named against a construct in it, so it can be checked against the source. Nothing here is inherited from a template, or from another language’s page.

Where you meet it in a repository

Recognised by extension — .hs, .lhs. Everything below is about where those files actually sit in a working repository.

  • A Cabal project splits a library into modules that write their export lists explicitly, so the public surface is stated in the file rather than inferred from it.
  • Type classes and their instances are separated: the class lives with the abstraction, the instances with the concrete types.
  • A foreign import declaration is the one place a Haskell file names a symbol that lives outside itself, and it is recorded as a reference to that external name.

Questions this index answers

Phrased as retrievals, because that is what an index can honestly do: it holds the symbols and the edges between them, and hands them back with the evidence attached.

  1. Which instances implement this type class?
  2. Which methods does this instance implement?
  3. Which constructors does this data type have?
  4. Which modules import this one, and what does each export?

What the analyzer sees in code like this

A module export list, a record type, a class, and the instance that implements it
module Data.Cart (Cart(..), place) where   -- bb records: module · exports Cart, place

data Cart = Cart { cartId :: !Int, total :: !Int }   -- bb records: type Cart · field total

class Chargeable a where
  charge :: a -> Int                          -- bb records: interface Chargeable

instance Chargeable Cart where
  charge c = cartTotal c                     -- bb records: an override of the class method

Symbols are stored with the file they came from and the bytes they span, so a hit points at a line rather than at a guess. The annotations in the sample are commentary for the reader, not strings the index would store.

Languages that turn up in the same repository

Functional & declarative — the count beside each name is how many relationship types that family’s analyzer constructs.

The extensions, registry names, recorded symbols and relationship types above are the parser registry row for Haskell, read while the page rendered — the same row the register reads, so the two surfaces cannot tell two stories. Every relationship type listed as constructed appears in src/ast/real-*, the analyzer modules bb ships. bb 0.1.0 answers from a local store over 50 languages (53 registry ids, three of them aliases). There is no benchmark on this page: every claim here is one you can go and read in the source.