You will need an explicit forall
in the textMax
signature, so that ScopedTypeVariables
starts, and n
in the Proxy n
annotation becomes the same n
in the KnownNat n
constraint:
textMax :: forall n. KnownNat n => Text -> Maybe (TextMax n) textMax t | Text.length t <= (fromIntegral $ natVal (Proxy :: Proxy n)) = Just (TextMax t) | otherwise = Nothing
source share