1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2025-03-20 04:46:22 +09:00

Basic pagination for Vervis

This commit is contained in:
fr33domlover 2016-05-11 14:42:41 +00:00
parent 117034a8fa
commit 17c4ff3d23
5 changed files with 131 additions and 16 deletions
src/Data
Functor
Paginate

32
src/Data/Functor/Local.hs Normal file
View file

@ -0,0 +1,32 @@
{- This file is part of Vervis.
-
- Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
-
- Copying is an act of love. Please copy, reuse and share.
-
- The author(s) have dedicated all copyright and related and neighboring
- rights to this software to the public domain worldwide. This software is
- distributed without any warranty.
-
- You should have received a copy of the CC0 Public Domain Dedication along
- with this software. If not, see
- <http://creativecommons.org/publicdomain/zero/1.0/>.
-}
module Data.Functor.Local
( fwith
, (<&>)
)
where
import Prelude
-- | Flipped 'fmap'.
fwith :: Functor f => f a -> (a -> b) -> f b
fwith = flip fmap
-- | Flipped '<$>'.
(<&>) :: Functor f => f a -> (a -> b) -> f b
(<&>) = flip (<$>)
infixr 4 <&>

View file

@ -98,10 +98,10 @@ data PaginateSettings m f i = PaginateSettings
, psPer :: Int
}
instance Monad m => Default (PaginateSettings m f i) where
instance Default (PaginateSettings m f i) where
def = PaginateSettings
{ psSelect = \ _ _ -> error "You didn't implement psSelect"
, psCurrent = return 1
{ psSelect = error "You didn't implement psSelect"
, psCurrent = error "You didn't implement psCurrent"
, psPer = 30
}