Skip to content

Commit 07f54c9

Browse files
committed
wip: cut down scope to only generating HasChunkRefs instances
1 parent 7ac6091 commit 07f54c9

File tree

2 files changed

+12
-10
lines changed
  • code
    • drasil-database/lib/Drasil/Database
    • drasil-lang/lib/Language/Drasil/Chunk

2 files changed

+12
-10
lines changed

code/drasil-database/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
@@ -14,7 +14,7 @@ module Language.Drasil.Chunk.NamedIdea (
1414

1515
import Control.Lens ((^.), makeLenses, Lens')
1616

17-
import Drasil.Database (mkUid, UID, HasUID(..), declareChunkType, Generically(..))
17+
import Drasil.Database (mkUid, UID, HasUID(..), declareHasChunkRefs, Generically(..))
1818
import Language.Drasil.NounPhrase.Core (NP)
1919

2020
-- TODO: Why does a NamedIdea need a UID? It might need a UID to be registered in the chunk map.
@@ -55,7 +55,7 @@ data IdeaDict = IdeaDict {
5555
_np :: NP,
5656
mabbr :: Maybe String
5757
}
58-
declareChunkType ''IdeaDict
58+
declareHasChunkRefs ''IdeaDict
5959
makeLenses ''IdeaDict
6060

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

0 commit comments

Comments
 (0)