From 376d435658ca72b1ab552ead3112b280d2fd2c1c Mon Sep 17 00:00:00 2001 From: KtorZ Date: Fri, 30 Jun 2017 18:39:10 +0200 Subject: [PATCH] add missing alternative case for Array in Eq, Ord and Show instances of IDBKey --- src/Database/IndexedDB/Core.purs | 4 ---- src/Database/IndexedDB/IDBKey/Internal.purs | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Database/IndexedDB/Core.purs b/src/Database/IndexedDB/Core.purs index 87b3e40..5ee1bd9 100644 --- a/src/Database/IndexedDB/Core.purs +++ b/src/Database/IndexedDB/Core.purs @@ -1,6 +1,5 @@ module Database.IndexedDB.Core ( class FromString, parse - , INDEXED_DB , IDB , CursorDirection(..) , CursorSource(..) @@ -24,9 +23,6 @@ import Data.Maybe (Maybe(..)) import Database.IndexedDB.IDBKey -foreign import data INDEXED_DB :: Effect - - foreign import data IDB :: Effect diff --git a/src/Database/IndexedDB/IDBKey/Internal.purs b/src/Database/IndexedDB/IDBKey/Internal.purs index 87def80..5bc434f 100644 --- a/src/Database/IndexedDB/IDBKey/Internal.purs +++ b/src/Database/IndexedDB/IDBKey/Internal.purs @@ -54,6 +54,8 @@ instance eqKey :: Eq Key where eq <$> ((fromKey a) :: F String) <*> fromKey b <|> eq <$> ((fromKey a) :: F DateTime) <*> fromKey b + <|> + eq <$> ((fromKey a) :: F (Array Key)) <*> fromKey b where runIdentity :: forall a. Identity a -> a runIdentity (Identity x) = x @@ -68,6 +70,8 @@ instance ordKey :: Ord Key where compare <$> ((fromKey a) :: F String) <*> fromKey b <|> compare <$> ((fromKey a) :: F DateTime) <*> fromKey b + <|> + compare <$> ((fromKey a) :: F (Array Key)) <*> fromKey b where runIdentity :: forall a. Identity a -> a runIdentity (Identity x) = x @@ -82,6 +86,8 @@ instance showKey :: Show Key where (show <$> (fromKey a :: F String)) <|> (show <$> (fromKey a :: F DateTime)) + <|> + (show <$> (fromKey a :: F (Array Key))) where format :: forall a. Identity (Either a String) -> String format (Identity x) =