2 % (c) The AQUA Project, Glasgow University, 1993-1995
4 \section[TcDefaults]{Typechecking \tr{default} declarations}
7 #include "HsVersions.h"
9 module TcDefaults ( tcDefaults ) where
13 import HsSyn ( DefaultDecl(..), MonoType,
14 HsExpr, HsLit, ArithSeqInfo, Fake, InPat)
15 import RnHsSyn ( RenamedDefaultDecl(..) )
16 import TcHsSyn ( TcIdOcc )
18 import TcMonad hiding ( rnMtoTcM )
19 import Inst ( InstOrigin(..) )
20 import TcEnv ( tcLookupClassByKey )
21 import SpecEnv ( SpecEnv )
22 import TcMonoType ( tcMonoType )
23 import TcSimplify ( tcSimplifyCheckThetas )
25 import TysWiredIn ( intTy, doubleTy, unitTy )
26 import Unique ( numClassKey )
31 tcDefaults :: [RenamedDefaultDecl]
32 -> TcM s [Type] -- defaulting types to heave
33 -- into Tc monad for later use
37 = returnTc [intTy, doubleTy] -- language-specified default `default'
39 tcDefaults [DefaultDecl mono_tys locn]
41 mapTc tcMonoType mono_tys `thenTc` \ tau_tys ->
44 [] -> returnTc [] -- no defaults
47 -- Check that all the types are instances of Num
48 -- We only care about whether it worked or not
50 tcLookupClassByKey numClassKey `thenNF_Tc` \ num ->
52 [ (num, ty) | ty <- tau_tys ] `thenTc_`