idris-1.0: Functional Programming Language with Dependent Types

Copyright | License : BSD3
Maintainer | The Idris Community.
Safe Haskell | None
Language | Haskell98

Idris.Coverage

Description

Synopsis

- genClauses :: FC -> Name -> [([Name], Term)] -> [PTerm] -> Idris [PTerm]
- validCoverageCase :: Context -> Err -> Bool
- recoverableCoverage :: Context -> Err -> Bool
- mkPatTm :: PTerm -> Idris Term

# Documentation

genClauses :: FC -> Name -> [([Name], Term)] -> [PTerm] -> Idris [PTerm] #

Given a list of LHSs, generate a extra clauses which cover the remaining cases. The ones which haven't been provided are marked `absurd` so that the checker will make sure they can't happen.

This will only work after the given clauses have been typechecked and the names are fully explicit!

validCoverageCase :: Context -> Err -> Bool #

Does this error result rule out a case as valid when coverage checking?

recoverableCoverage :: Context -> Err -> Bool #

Check whether an error is recoverable in the sense needed for coverage checking.

mkPatTm :: PTerm -> Idris Term #

Generate a pattern from an `impossible` LHS.

We need this to eliminate the pattern clauses which have been provided explicitly from new clause generation.

This takes a type directed approach to disambiguating names. If we can't immediately disambiguate by looking at the expected type, it's an error (we can't do this the usual way of trying it to see what type checks since the whole point of an impossible case is that it won't type check!)