userid-0.1.3.7/0000755000000000000000000000000007346545000011344 5ustar0000000000000000userid-0.1.3.7/Data/0000755000000000000000000000000007346545000012215 5ustar0000000000000000userid-0.1.3.7/Data/UserId.hs0000644000000000000000000000247407346545000013753 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable, DeriveGeneric, GeneralizedNewtypeDeriving, TemplateHaskell #-} {- | This module provides a `UserId` type plus some useful instances for web development. -} module Data.UserId where import Control.Applicative ((<$>)) import Data.Aeson (FromJSON(..), ToJSON(..), Result(..), fromJSON) import Data.Data (Data) import Data.SafeCopy (SafeCopy, base, deriveSafeCopy) import Data.Serialize (Serialize) import Data.Typeable (Typeable) import GHC.Generics (Generic) import Text.Boomerang.TH (makeBoomerangs) import Web.Routes (PathInfo(..)) import Web.Routes.TH (derivePathInfo) -- | a 'UserId' uniquely identifies a user. newtype UserId = UserId { _unUserId :: Integer } deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic, Serialize) deriveSafeCopy 1 'base ''UserId -- makeLenses ''UserId unUserId f (UserId x) = fmap UserId (f x) {-# INLINE unUserId #-} makeBoomerangs ''UserId instance ToJSON UserId where toJSON (UserId i) = toJSON i instance FromJSON UserId where parseJSON v = UserId <$> parseJSON v instance PathInfo UserId where toPathSegments (UserId i) = toPathSegments i fromPathSegments = UserId <$> fromPathSegments -- | get the next `UserId` succUserId :: UserId -> UserId succUserId (UserId i) = UserId (succ i) userid-0.1.3.7/LICENSE0000644000000000000000000000276007346545000012356 0ustar0000000000000000Copyright (c) 2015, Jeremy Shaw All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Jeremy Shaw nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. userid-0.1.3.7/Setup.hs0000644000000000000000000000005607346545000013001 0ustar0000000000000000import Distribution.Simple main = defaultMain userid-0.1.3.7/userid.cabal0000644000000000000000000000227107346545000013625 0ustar0000000000000000name: userid version: 0.1.3.7 synopsis: The UserId type and useful instances for web development description: Includes instances for SafeCopy, Lens, Boomerang, PathInfo and more homepage: http://www.github.com/Happstack/userid license: BSD3 license-file: LICENSE author: Jeremy Shaw maintainer: jeremy@n-heptane.com category: Data build-type: Simple cabal-version: >=1.10 tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.1, GHC==8.6.5, GHC==8.8.3, GHC==8.10.7, GHC==9.0.2, GHC==9.2.1 source-repository head type: git location: git://github.com/Happstack/userid.git library exposed-modules: Data.UserId build-depends: base >= 4.6 && < 4.17, aeson >= 0.9 && < 2.1, boomerang >= 1.4 && < 1.5, cereal == 0.5.*, safecopy >= 0.8 && < 0.11, web-routes >= 0.27 && < 0.28, web-routes-th >= 0.22 && < 0.23 default-language: Haskell2010