From 63ed03865494887f7da339817de30fc193ee6c79 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 16 Jun 2016 11:58:17 -0400 Subject: [PATCH] :memo: why OVERLAPPABLE. --- src/Data/Record.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Data/Record.hs b/src/Data/Record.hs index 70b2a6df9..2f62148a0 100644 --- a/src/Data/Record.hs +++ b/src/Data/Record.hs @@ -33,6 +33,8 @@ class HasField (fields :: [*]) (field :: *) where -- Instances +-- OVERLAPPABLE is required for the HasField instances so that we can handle the two cases: either the head of the non-empty h-list is the requested field, or it isn’t. The third possible case (the h-list is empty) is rejected at compile-time. + instance {-# OVERLAPPABLE #-} HasField fields field => HasField (notIt ': fields) field where getField (RCons _ t) = getField t