This file contains hidden or 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
sealed abstract case class Profile( | |
personId:PersonId, | |
timezone:DateTimeZone, | |
profileStatus:PersonStatus, // CUSTOMER, DISABLED, etc | |
schedulingHours:List[Constraint] | |
... | |
) | |
sealed trait Coordination | |
case class AssistantTo(p:Profile) extends Coordination// assistants are independent of the Meeting |
This file contains hidden or 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 features | |
import shapeless._ | |
import ops.hlist.Selector | |
import syntax.std.function._ | |
import ops.function._ | |
import simulacrum._ | |
import scalaz._, Scalaz._ | |
object Main { | |
import utils.Find |
This file contains hidden or 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 features | |
import shapeless._ | |
import ops.hlist.Selector | |
import syntax.std.function._ | |
import ops.function._ | |
import simulacrum._ | |
import scalaz._, Scalaz._ | |
object Main { | |
import utils.Find |
This file contains hidden or 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
[info] Compiling 1 Scala source to /Users/caente1/workshop/filter_field/target/scala-2.11/classes... | |
[info] /Users/caente1/workshop/filter_field/src/main/scala/main.scala:70: shapeless.this.Generic.materialize is not a valid implicit value for shapeless.Generic.Aux[snippet.ATrait,V] because: | |
[info] type parameters weren't correctly instantiated outside of the implicit tree: inferred type arguments [shapeless.:+:[snippet.A1,shapeless.:+:[snippet.A2,shapeless.CNil]],Nothing] do not conform to method materializeProduct's type parameter bounds [V <: shapeless.HList,R <: shapeless.HList] | |
[info] assert(FilterField[ATrait].filterField( '_id, atrait ) == 1 :: HNil) | |
[info] ^ | |
[info] /Users/caente1/workshop/filter_field/src/main/scala/main.scala:70: shapeless.this.LabelledGeneric.materializeProduct is not a valid implicit value for shapeless.LabelledGeneric.Aux[snippet.ATrait,G] because: | |
[info] hasMatchingSymbol reported error: could not find implicit value for parameter gen: shapeless.Generic.Aux[ |
This file contains hidden or 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
import shapeless._ | |
import ops.{ hlist => hl, coproduct => cp } | |
object FlexibleTypes2 { | |
/* | |
it extracts the values of a common type from a hierarchy of case classes | |
*/ | |
This file contains hidden or 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
implicit class TaggedMonad[A, B](val t:A @@ B ) extends AnyVal { | |
def map[C](f: A => C ):C @@ B = Tag[C, B](f(Tag.unwrap(t))) | |
def flatMap[C](f : A => C @@ B): C @@ B =f(Tag.unwrap(t)) | |
} | |
sealed trait A | |
sealed trait B | |
val i: Int @@ A = Tag[Int, A](1) |
This file contains hidden or 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
case class Stretch( | |
before: Int, | |
after: Int | |
) | |
case class MidnightRange( | |
start: Int, | |
end: Int | |
) |
This file contains hidden or 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
object typesWrapped { | |
case class Divided( value: Int ) extends AnyVal | |
case class Subtracted( value: Int ) extends AnyVal | |
case class Multiplied( value: Int ) extends AnyVal | |
def divide( i: Int ): Divided = Divided( ( i / 5 ).toInt ) | |
def subtract( i: Divided ): Subtracted = Subtracted( i.value - 10 ) |
This file contains hidden or 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
object types { | |
def divide(i: Int): Int = (i/5).toInt | |
def subtract(i: Int): Int = i - 10 | |
def multiply(i: Int): Int = i * -1 | |
def allOK(i: Int):Int = { | |
val s1 =divide(i) |
This file contains hidden or 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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.dimeder</groupId> | |
<artifactId>llull</artifactId> | |
<packaging>war</packaging> | |
<version>1.0-SNAPSHOT</version> | |
<name>llull Maven Webapp</name> | |
<url>http://maven.apache.org</url> | |
<properties> |