Skip to content

Instantly share code, notes, and snippets.

@geekingfrog
Created August 24, 2019 08:51
Show Gist options
  • Save geekingfrog/d41af4f3127362266ce72f575b5c3642 to your computer and use it in GitHub Desktop.
Save geekingfrog/d41af4f3127362266ce72f575b5c3642 to your computer and use it in GitHub Desktop.
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
module Main where
import Data.Valor ( Validatable, Validate )
import Data.Text ( Text )
import Data.Functor.Identity ( Identity (..) )
import Data.Aeson
import GHC.Generics
data User' a = User
{ username :: Validatable a String Text
, password :: Validatable a [String] Text
}
type User = User' Identity
deriving instance Show User
deriving instance Generic User
deriving instance ToJSON User
deriving instance FromJSON User
type UserError = User' Validate
deriving instance Show UserError
main :: IO ()
main = putStrLn "yo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment