summaryrefslogtreecommitdiff
path: root/testsuite/tests/plugins/test-defaulting-plugin-fail.hs
blob: c751f3f5c13f03921e4c22ac2fdae897620613ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{-# LANGUAGE MultiParamTypeClasses, KindSignatures, FlexibleInstances, DataKinds, PolyKinds, RankNTypes, AllowAmbiguousTypes, TypeOperators, TypeFamilies, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fplugin DefaultLifted -fwarn-type-defaults #-}

-- Tests defaulting plugins
module Main where
import GHC.TypeLits
import Data.Proxy
import DefaultLifted

instance DefaultType Nat 4
instance DefaultType Nat 2
instance DefaultType Nat 0

q :: forall (a :: Nat). (KnownNat a) => Integer
q = natVal (Proxy :: Proxy a)

w :: forall (a :: Nat). (KnownNat a, 2 <= a) => Integer
w = natVal (Proxy :: Proxy a)

e :: forall (a :: Nat). (KnownNat a, 5 <= a) => Integer
e = natVal (Proxy :: Proxy a)

main :: IO ()
main = do
  print $ q + w + e