mirror of
https://github.com/github/semantic.git
synced 2025-01-03 04:51:57 +03:00
Define an algebra using toDeclaration.
This commit is contained in:
parent
7203134bc2
commit
4d810c347c
@ -10,6 +10,7 @@ module Renderer.TOC
|
||||
, declaration
|
||||
, declarationAlgebra
|
||||
, markupSectionAlgebra
|
||||
, toDeclarationAlgebra
|
||||
, syntaxDeclarationAlgebra
|
||||
, Entry(..)
|
||||
, tableOfContentsBy
|
||||
@ -95,6 +96,10 @@ data Declaration
|
||||
class HasDeclaration whole part where
|
||||
toDeclaration :: (HasField fields Range, HasField fields Span) => Blob -> Record fields -> RAlgebra part (Term whole (Record fields)) (Maybe Declaration)
|
||||
|
||||
toDeclarationAlgebra :: (HasField fields Range, HasField fields Span, HasDeclaration syntax syntax) => Blob -> RAlgebra (TermF syntax (Record fields)) (Term syntax (Record fields)) (Maybe Declaration)
|
||||
toDeclarationAlgebra blob (In ann syntax) = toDeclaration blob ann syntax
|
||||
|
||||
|
||||
instance (DeclarationStrategy part ~ strategy, HasDeclarationWithStrategy strategy whole part) => HasDeclaration whole part where
|
||||
toDeclaration = toDeclarationWithStrategy (undefined :: proxy strategy)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user