Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compile with conduit 0.5.5 and persistent 1.1
- Loading branch information
1 parent
2b40e35
commit 4033b83
Showing
7 changed files
with
267 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,60 +1,63 @@ | |||
{-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies, OverloadedStrings, GADTs, FlexibleContexts, EmptyDataDecls #-} | {-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies, OverloadedStrings, GADTs, FlexibleContexts, EmptyDataDecls #-} | ||
|
|
||
module Scion.PersistentBrowser.DbTypes where | module Scion.PersistentBrowser.DbTypes where | ||
|
|
||
import Database.Persist | import Database.Persist | ||
-- import Database.Persist.Base | -- import Database.Persist.Base | ||
import Database.Persist.Sqlite | import Database.Persist.Sqlite | ||
import Database.Persist.TH | import Database.Persist.TH | ||
|
import Data.Conduit (ResourceT) | ||
data DbDeclType = DbData | DbNewType | DbClass | DbInstance | DbSignature | DbType |
|
||
deriving (Show, Read, Eq) | type SQL a= SqlPersist (ResourceT IO) a | ||
derivePersistField "DbDeclType" |
|
||
|
data DbDeclType = DbData | DbNewType | DbClass | DbInstance | DbSignature | DbType | ||
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persist| | deriving (Show, Read, Eq) | ||
DbPackage | derivePersistField "DbDeclType" | ||
name String |
|
||
version String | share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persist| | ||
doc String Maybe | DbPackage | ||
UniqueVersion name version | name String | ||
DbModule | version String | ||
name String | doc String Maybe | ||
doc String Maybe | UniqueVersion name version | ||
packageId DbPackageId | DbModule | ||
DbDecl | name String | ||
declType DbDeclType | doc String Maybe | ||
name String | packageId DbPackageId | ||
doc String Maybe | DbDecl | ||
-- Depending on the type of decl, | declType DbDeclType | ||
-- it will have some of these | name String | ||
kind String Maybe | doc String Maybe | ||
signature String Maybe | -- Depending on the type of decl, | ||
equals String Maybe | -- it will have some of these | ||
moduleId DbModuleId | kind String Maybe | ||
DbTyVar | signature String Maybe | ||
name String | equals String Maybe | ||
declId DbDeclId | moduleId DbModuleId | ||
DbFunDep | DbTyVar | ||
name String | name String | ||
declId DbDeclId | declId DbDeclId | ||
DbContext | DbFunDep | ||
shown String | name String | ||
declId DbDeclId | declId DbDeclId | ||
DbConstructor | DbContext | ||
name String | shown String | ||
-- Called 'type' in Json output | declId DbDeclId | ||
signature String | DbConstructor | ||
declId DbDeclId | name String | ||
|] | -- Called 'type' in Json output | ||
|
signature String | ||
-- |Information needed to search a package. | declId DbDeclId | ||
data DbPackageIdentifier = DbPackageIdentifier String String -- name, version | |] | ||
deriving Eq |
|
||
|
-- |Information needed to search a package. | ||
dbPackageToIdentifier :: DbPackage -> DbPackageIdentifier | data DbPackageIdentifier = DbPackageIdentifier String String -- name, version | ||
dbPackageToIdentifier (DbPackage name version _) = DbPackageIdentifier name version | deriving Eq | ||
|
|
||
-- |Complete information for a declaration. | dbPackageToIdentifier :: DbPackage -> DbPackageIdentifier | ||
-- Look at its ToJSON instance to know which one is used in each kind of declaration. | dbPackageToIdentifier (DbPackage name version _) = DbPackageIdentifier name version | ||
data DbCompleteDecl = DbCompleteDecl DbDecl [DbContext] [DbTyVar] [DbFunDep] [DbConstructor] |
|
||
|
-- |Complete information for a declaration. | ||
-- Look at its ToJSON instance to know which one is used in each kind of declaration. | |||
data DbCompleteDecl = DbCompleteDecl DbDecl [DbContext] [DbTyVar] [DbFunDep] [DbConstructor] | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.