Skip to content

GHC-94210 "Pattern match has inaccessible right hand side" is undocumented #479

@zarakshR

Description

@zarakshR

For this example code -

{-# LANGUAGE GADTs #-}

data HList a where
    HNil  :: HList ()
    HCons :: head -> HList tail -> HList (head, tail)

exampleHList :: HList (String, (Int, (Bool, ())))
exampleHList = HCons "Tom" (HCons 25 (HCons True HNil))

hListHead :: HList (a,b) -> a
hListHead HNil = undefined
hListHead (HCons head tail) = head

ghc 9.0.2 provides the following undocumented warning -

example.hs:11:1: warning: [-Woverlapping-patterns]
    Pattern match has inaccessible right hand side
    In an equation for ‘hListHead’: hListHead HNil = ...
   |
11 | hListHead HNil = undefined
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions