This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
module Main where | |
import Control.Monad.Identity | |
data User = User | |
{ name :: String | |
, firstName :: String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
module Main where | |
import Control.Monad.Except | |
import Control.Monad.Reader | |
import Control.Monad.State | |
import Control.Monad.Writer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Monad.Identity | |
-- boostrap the conditions leading to 2 different implementations of the same business logic | |
main :: IO () | |
main = do | |
-- use a monad instance as 1st parameter in order to choose the implementation | |
expectedCalledWithMaybeInstance <- putStrLn $ getFirstName Nothing "heyhey" | |
expectedCalledWithIOInstance <- putStrLn $ getFirstName (Identity 0) "hoho" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/auth0/go-jwt-middleware" | |
"github.com/dgrijalva/jwt-go" | |
"gopkg.in/gin-gonic/gin.v1" | |
) | |
func main() { | |
startServer() |
NewerOlder