@@ -34,6 +34,7 @@ import Control.Monad
35-- | Elaborate a record declaration
35-- | Elaborate a record declaration
36elabRecord :: ElabInfo
36elabRecord :: ElabInfo
37 -> (Docstring (Either Err PTerm)) -- ^ The documentation for the whole declaration
38 -> (Docstring (Either Err PTerm)) -- ^ The documentation for the whole declaration
38 -> SyntaxInfo -> FC -> DataOpts
39 -> SyntaxInfo -> FC -> DataOpts
39 -> Name -- ^ The name of the type being defined
40 -> Name -- ^ The name of the type being defined
@@ -45,7 +46,7 @@ elabRecord :: ElabInfo
45 -> (Docstring (Either Err PTerm)) -- ^ Constructor Doc
46 -> (Docstring (Either Err PTerm)) -- ^ Constructor Doc
46 -> SyntaxInfo -- ^ Constructor SyntaxInfo
47 -> SyntaxInfo -- ^ Constructor SyntaxInfo
47 -> Idris ()
48 -> Idris ()
48−elabRecord info doc rsyn fc opts tyn nfc params paramDocs fields cname cdoc csyn
49+elabRecord info what doc rsyn fc opts tyn nfc params paramDocs fields cname cdoc csyn
49 = do logLvl 1 $ "Building data declaration for " ++ show tyn
50 = do logLvl 1 $ "Building data declaration for " ++ show tyn
50 -- Type constructor
51 -- Type constructor
51 let tycon = generateTyConType params
52 let tycon = generateTyConType params
@@ -58,17 +59,20 @@ elabRecord info doc rsyn fc opts tyn nfc params paramDocs fields cname cdoc csyn
59 -- Build data declaration for elaboration
60 -- Build data declaration for elaboration
60 logLvl 1 $ foldr (++) "" $ intersperse "\n" (map show dconsArgDocs)
61 logLvl 1 $ foldr (++) "" $ intersperse "\n" (map show dconsArgDocs)
62+ let datadecl = case what of
63+ ETypes -> PLaterdecl tyn NoFC tycon
61− let datadecl = PDatadecl tyn NoFC tycon [(cdoc, dconsArgDocs, dconName, NoFC, dconTy, fc, [])]
64+ _ -> PDatadecl tyn NoFC tycon [(cdoc, dconsArgDocs, dconName, NoFC, dconTy, fc, [])]
62 elabData info rsyn doc paramDocs fc opts datadecl
65 elabData info rsyn doc paramDocs fc opts datadecl
67+ when (what /= ETypes) $ do
64− logLvl 1 $ "fieldsWithName " ++ show fieldsWithName
68+ logLvl 1 $ "fieldsWithName " ++ show fieldsWithName
65− logLvl 1 $ "fieldsWIthNameAndDoc " ++ show fieldsWithNameAndDoc
69+ logLvl 1 $ "fieldsWIthNameAndDoc " ++ show fieldsWithNameAndDoc
66− elabRecordFunctions info rsyn fc tyn paramsAndDoc fieldsWithNameAndDoc dconName target
70+ elabRecordFunctions info rsyn fc tyn paramsAndDoc fieldsWithNameAndDoc dconName target
68− sendHighlighting $
72+ sendHighlighting $
69− [(nfc, AnnName tyn Nothing Nothing Nothing)] ++
73+ [(nfc, AnnName tyn Nothing Nothing Nothing)] ++
70− maybe [] (\(_, cnfc) -> [(cnfc, AnnName dconName Nothing Nothing Nothing)]) cname ++
74+ maybe [] (\(_, cnfc) -> [(cnfc, AnnName dconName Nothing Nothing Nothing)]) cname ++
71− [(ffc, AnnBoundName fn False) | (fn, ffc, _, _, _) <- fieldsWithName]
75+ [(ffc, AnnBoundName fn False) | (fn, ffc, _, _, _) <- fieldsWithName]
74 -- | Generates a type constructor.
78 -- | Generates a type constructor.