Skip to content

Commit 388c0a3

Browse files
committed
wip: cut down scope to only generating HasChunkRefs instances
1 parent e79f5cc commit 388c0a3

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

code/drasil-lang/lib/Drasil/Database/TH.hs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{-# LANGUAGE TemplateHaskellQuotes #-}
22
module Drasil.Database.TH (
3-
-- * The Magic
4-
declareChunkType,
5-
-- * Re-exports from GHC.Generics for convenience
6-
Generic,
7-
Generically(..)
3+
-- * The Magic
4+
declareHasChunkRefs,
5+
-- * Re-exports from GHC.Generics for convenience
6+
Generic,
7+
Generically(..)
88
) where
99

1010
import GHC.Generics (Generic, Generically(..))
@@ -14,9 +14,11 @@ import Drasil.Database.Chunk (HasChunkRefs)
1414

1515
-- | Declares that a type is a chunk type; Generates an instance of
1616
-- 'HasChunkRefs'.
17-
declareChunkType :: Name -> Q [Dec]
18-
declareChunkType = deriveGenerically ''HasChunkRefs
19-
-- TODO: 'declareChunkType' can also create a `HasUID` instance.
17+
declareHasChunkRefs :: Name -> Q [Dec]
18+
declareHasChunkRefs = deriveGenerically ''HasChunkRefs
19+
20+
-- TODO: Create a 'declareChunkType' that creates a `HasUID` instance along with
21+
-- the `HasChunkRefs` instance.
2022

2123
-- FIXME: 'deriveGenerically' should belong in `drasil-utils` because it is for
2224
-- Generically, nothing specific to the database :)

code/drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module Language.Drasil.Chunk.NamedIdea (
1515
import Control.Lens ((^.), makeLenses, Lens')
1616

1717
import Drasil.Database.UID (mkUid, UID, HasUID(..))
18-
import Drasil.Database.TH (declareChunkType, Generically(..))
18+
import Drasil.Database.TH (declareHasChunkRefs, Generically(..))
1919

2020
import Language.Drasil.NounPhrase.Core (NP)
2121

@@ -57,7 +57,7 @@ data IdeaDict = IdeaDict {
5757
_np :: NP,
5858
mabbr :: Maybe String
5959
}
60-
declareChunkType ''IdeaDict
60+
declareHasChunkRefs ''IdeaDict
6161
makeLenses ''IdeaDict
6262

6363
-- | Equal if 'UID's are equal.

0 commit comments

Comments
 (0)