Skip to content

sammthomson/IdiomEars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

IdiomEars

Idiom brackets à la "Applicative programming with effects", McBride and Paterson. Allows the following syntax for Applicatives like Option, List, etc.:

import cats.std.list._
import com.samthomson.idiomears._
val f = (a: Int) => (b: Int) => a * b
⊏| (f) (List(1, 2)) (List(3, 4)) |// List(3, 4, 6, 8)| (f) (List(1)) (Nil) |// List()

which is equivalent to

Applicative[List].pure(f).ap(List(1)).ap(Nil)

Unicode is cute, but annoying to type, so there's the ascii alternative:

*| (f) (List(1)) (Nil) |*

If you're against symbolic operators, which you probably should be, just don't use this.

SBT

Add the following lines to your build.sbt:

resolvers += Resolver.bintrayRepo("sammthomson", "maven")

libraryDependencies += "com.samthomson" %% "idiomears" % "1.0"

About

Idiom brackets for Scala cats

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages