stan-0.1.2.1: Haskell STatic ANalyser

Copyright | (c) 2020 Kowainik
License | MPL-2.0
Maintainer | Kowainik <xrom.xkov@gmail.com>
Safe Haskell | None
Language | Haskell2010

Stan.Hie.MatchType

Description

Some `Inspection`s require to know about types and some mechanism to match types to the given `PatternType`. This information on types/type expressions is taken from `HIE files` in a more suitable view.

Let's take a look at the function `foo`:

    foo :: NonEmpty String -> Int

In `HIE` files it will be stored as an `Array` like this:

      1 -> Int      []
      2 -> String   []
      3 -> NonEmpty [ 2 ]
      4 -> FunType    3 1

This module contains an implementation of the process of retrieval of this information from there.

Synopsis

- hieMatchPatternType :: Array TypeIndex HieTypeFlat -> PatternType -> TypeIndex -> Bool

# Documentation

hieMatchPatternType #

Arguments

:: Array TypeIndex HieTypeFlat | Array of all types in HIE file
-> PatternType | Our search query
-> TypeIndex | Index of the current expression type
-> Bool | If matched type is found

Matching function that searches the array of types recursively.