Skip to content

Instantly share code, notes, and snippets.

@mattroberts297
Created January 4, 2019 20:13
Show Gist options
  • Save mattroberts297/0629413290170d6c71435e4ca710f92c to your computer and use it in GitHub Desktop.
Save mattroberts297/0629413290170d6c71435e4ca710f92c to your computer and use it in GitHub Desktop.
SignupCore.scala
def signupImpl
[F[_], A: IsParseable[F, ?], B: HasCodes]
(a: A): Signup[SignupError Or B] =
OrT.value {
for {
r <- parse(a) |> OrT.lift
_ <- log(info("Parsed body")) |> OrT.lift
s <- salt(512) |> OrT.lift
_ <- log(info("Created salt")) |> OrT.lift
h <- hash(r.p, s, 10000) |> OrT.lift
_ <- log(info("Created hash")) |> OrT.lift
u = User(r.e, h, s)
_ <- persist(u) |> OrT.lift
_ <- logW(info("Persisted user")) |> OrT.lift
} yield { HasCodes[B].success }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment