Change the format to a list

This commit is contained in:
Mats Rauhala 2021-01-01 07:55:10 +02:00
parent 98f732dbd2
commit e741d7fd59
3 changed files with 8 additions and 10 deletions

View File

@ -52,6 +52,8 @@ library
, exceptions
, bytestring
, filepath
, vector
, hashids
hs-source-dirs: src
executable buuka

View File

@ -1,7 +1,7 @@
{ mkDerivation, aeson, base, bytestring, conduit, conduit-extra
, containers, exceptions, filepath, hedgehog, hedgehog-corpus, mtl
, optparse-applicative, stdenv, tasty, tasty-hedgehog, text
, transformers, unliftio, yaml
, containers, exceptions, filepath, hashids, hedgehog
, hedgehog-corpus, mtl, optparse-applicative, stdenv, tasty
, tasty-hedgehog, text, transformers, unliftio, vector, yaml
}:
mkDerivation {
pname = "buuka";
@ -11,7 +11,7 @@ mkDerivation {
isExecutable = true;
libraryHaskellDepends = [
aeson base bytestring conduit conduit-extra containers exceptions
filepath mtl transformers unliftio yaml
filepath hashids mtl transformers unliftio vector yaml
];
executableHaskellDepends = [ base optparse-applicative unliftio ];
testHaskellDepends = [

View File

@ -11,10 +11,6 @@ module Data.Buuka
)
where
import Data.Map
(Map)
import qualified Data.Map.Strict as M
import Database.Migrations
import Data.Aeson
@ -38,12 +34,12 @@ data BuukaEntry
instance SafeJSON BuukaEntry where
type Version BuukaEntry = 0
newtype Buuka = Buuka ( Map URL BuukaEntry )
newtype Buuka = Buuka [BuukaEntry]
deriving stock (Show, Eq)
deriving newtype (Semigroup, Monoid, FromJSON, ToJSON)
insert :: BuukaEntry -> Buuka -> Buuka
insert e (Buuka b) = Buuka (M.insert (url e) e b)
insert e (Buuka b) = Buuka (e : b)
instance SafeJSON Buuka where
type Version Buuka = 0