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._ | |
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
// THE IMPLICIT CLASS THAT ALLOWS TO CALL #copy ON ANY SEALED TRAIT INSTANCE | |
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
object copySyntax { | |
implicit class CopySyntax[TypeToCopy](thingToCopy: TypeToCopy) { |
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
module Main where | |
main = putStrLn (show (fforall (\x -> (x >= -1000)) (setInt))) | |
type Set a = a -> Bool | |
setInt :: Set Int | |
setInt = \x -> True | |
--filtering the range with the set function and checking if all elements from the set satisfy the predicate | |
fforall :: Restrict a => (a -> Bool) -> Set a -> Bool |
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 baccata | |
/** | |
* Inspired from Grant Beaty's Scunits | |
*/ | |
trait Bool { | |
type branch[B,T <: B, E <: B] <: B // typelevel if-then-else | |
type not <: Bool | |
type or[R <: Bool] <: Bool | |
type and[R <: Bool] <: Bool |
NewerOlder