Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
outillage
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alice Brenon
outillage
Commits
b9572a96
Commit
b9572a96
authored
1 year ago
by
Alice Brenon
Browse files
Options
Downloads
Patches
Plain Diff
Commit library files used in scripts which should have been committed earlier
parent
c1195363
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/GEODE/Metadata/ParagraphRecord.hs
+40
-0
40 additions, 0 deletions
lib/GEODE/Metadata/ParagraphRecord.hs
lib/GEODE/Metadata/ProdigyMeta.hs
+33
-0
33 additions, 0 deletions
lib/GEODE/Metadata/ProdigyMeta.hs
with
73 additions
and
0 deletions
lib/GEODE/Metadata/ParagraphRecord.hs
0 → 100644
+
40
−
0
View file @
b9572a96
{-# LANGUAGE DeriveGeneric, ExplicitNamespaces, NamedFieldPuns, OverloadedStrings #-}
module
GEODE.Metadata.ParagraphRecord
(
Paragraph
(
..
)
,
ParagraphRecord
)
where
import
Data.Aeson
((
.=
),
FromJSON
(
..
),
ToJSON
(
..
))
import
Data.Aeson.KeyMap
as
KeyMap
(
singleton
)
import
Data.Csv
(
(
.:
),
FromNamedRecord
(
..
),
ToNamedRecord
(
..
),
namedField
,
namedRecord
)
import
GEODE.Metadata
as
Article
(
type
(
@
)(
..
),
ArticleRecord
,
DefaultFields
(
..
),
HasDefaultHeader
(
..
)
,
Record
(
..
),
ToJSONObject
(
..
),
uid
,
relativePath
)
import
GHC.Generics
(
Generic
)
import
System.FilePath
((
<.>
))
newtype
Paragraph
=
Paragraph
{
paragraph
::
Int
}
deriving
(
Generic
,
Show
)
instance
FromJSON
Paragraph
instance
Record
Paragraph
where
uid
=
show
.
paragraph
relativePath
(
Paragraph
{
paragraph
})
extension
=
show
paragraph
<.>
extension
type
ParagraphRecord
=
ArticleRecord
@
Paragraph
instance
FromNamedRecord
Paragraph
where
parseNamedRecord
nr
=
Paragraph
<$>
nr
.:
"paragraph"
instance
ToNamedRecord
Paragraph
where
toNamedRecord
(
Paragraph
{
paragraph
})
=
namedRecord
[
namedField
"paragraph"
paragraph
]
instance
ToJSONObject
Paragraph
where
toJSONObject
(
Paragraph
{
paragraph
})
=
KeyMap
.
singleton
"paragraph"
(
toJSON
paragraph
)
toJSONPairs
(
Paragraph
{
paragraph
})
=
"paragraph"
.=
paragraph
instance
HasDefaultHeader
Paragraph
where
defaultFields
=
DefaultFields
[
"paragraph"
]
This diff is collapsed.
Click to expand it.
lib/GEODE/Metadata/ProdigyMeta.hs
0 → 100644
+
33
−
0
View file @
b9572a96
{-# LANGUAGE DeriveGeneric, ExplicitNamespaces, OverloadedStrings #-}
module
GEODE.Metadata.ProdigyMeta
(
ParagraphMeta
,
ProdigyMeta
(
..
)
)
where
import
Data.Aeson
((
.=
),
FromJSON
(
..
),
ToJSON
(
..
))
import
Data.Aeson.KeyMap
as
KeyMap
(
fromList
)
import
Data.Csv
(
FromNamedRecord
(
..
),
ToNamedRecord
(
..
))
import
Data.Text
(
Text
)
import
GEODE.Metadata
(
type
(
@
),
DefaultFields
(
..
),
HasDefaultHeader
(
..
),
ToJSONObject
(
..
))
import
GEODE.Metadata.ParagraphRecord
(
ParagraphRecord
)
import
GHC.Generics
(
Generic
)
data
ProdigyMeta
=
ProdigyMeta
{
totalParagraphs
::
Int
,
headword
::
Text
}
deriving
(
Generic
,
Show
)
instance
FromJSON
ProdigyMeta
instance
ToJSONObject
ProdigyMeta
where
toJSONObject
(
ProdigyMeta
{
totalParagraphs
,
headword
})
=
KeyMap
.
fromList
[
(
"totalParagraphs"
,
toJSON
totalParagraphs
)
,
(
"headword"
,
toJSON
headword
)
]
toJSONPairs
(
ProdigyMeta
{
totalParagraphs
,
headword
})
=
"totalParagraphs"
.=
totalParagraphs
<>
"headword"
.=
headword
instance
ToNamedRecord
ProdigyMeta
instance
FromNamedRecord
ProdigyMeta
instance
HasDefaultHeader
ProdigyMeta
where
defaultFields
=
DefaultFields
[
"totalParagraphs"
,
"headword"
]
type
ParagraphMeta
=
ParagraphRecord
@
ProdigyMeta
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment