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
doi=10.1097%2F00125817-200001000-00001&doi=10.1097%2F00125817-200001000-00002&doi=10.1097%2F00125817-200001000-00003&doi=10.1097%2F00125817-200001000-00004&doi=10.1097%2F00125817-200001000-00005&doi=10.1097%2F00125817-200001000-00006&doi=10.1097%2F00125817-200001000-00007&doi=10.1097%2F00125817-200001000-00008&doi=10.1097%2F00125817-200001000-00009&doi=10.1097%2F00125817-200001000-00010&doi=10.1097%2F00125817-200001000-00011&doi=10.1097%2F00125817-200001000-00012&doi=10.1097%2F00125817-200001000-00013&doi=10.1097%2F00125817-200001000-00014&doi=10.1097%2F00125817-200001000-00015&doi=10.1097%2F00125817-200001000-00016&doi=10.1097%2F00125817-200001000-00017&doi=10.1097%2F00125817-200001000-00018&doi=10.1097%2F00125817-200001000-00019&doi=10.1097%2F00125817-200001000-00020&doi=10.1097%2F00125817-200001000-00021&doi=10.1097%2F00125817-200001000-00022&doi=10.1097%2F00125817-200001000-00023&doi=10.1097%2F00125817-200001000-00024&doi=10.1097%2F00125817-200001000-00025&doi=10.1097%2F00125817-200001000-00026&doi=10.109 |
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
sbt:contenthub-api> runtime:dependencyTree | |
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings. | |
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings. | |
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings. | |
[info] contenthub:contenthub-api-ontologies_2.12:LOCAL | |
[info] com.getsentry.raven:raven-logback:8.0.3 | |
[info] +-ch.qos.logback:logback-classic:1.2.1 (evicted by: 1.2.3) | |
[info] +-ch.qos.logback:logback-classic:1.2.3 | |
[info] | +-ch.qos.logback:logback-core:1.2.3 | |
[info] | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.28) |
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
import cats.effect.IO | |
import io.circe.{Decoder, Json} | |
import org.http4s.circe._ | |
import org.http4s.{Response, Status} | |
import org.scalatest.EitherValues | |
import org.scalatest.matchers.{HavePropertyMatchResult, HavePropertyMatcher} | |
trait Http4sMatchers { this: EitherValues => | |
def status(expected: Status) = HavePropertyMatcher { response: Response[IO] => | |
HavePropertyMatchResult(matches = response.status == expected, |
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 MyList where | |
import Data.Monoid | |
import Test.QuickCheck | |
import Test.QuickCheck.Classes | |
import Test.QuickCheck.Checkers | |
data List' a = Nil' | Cons' a (List' a) deriving (Eq, Show) | |
instance Monoid (List' a) where |
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
λ> (\x -> Cons' x Nil') <$> (Just $ Right 5) | |
Just (Cons' (Right 5) Nil') | |
-- The whole reason of using Compose is acting as a type constructor, here we ended up making Just and Right part | |
-- of the Compose structure hence we only 5 is passed to the function (\x -> Cons' x Nil) | |
λ> (\x -> Cons' x Nil') <$> (Compose $ Just $ Right 5) | |
Compose (Just (Right (Cons' 5 Nil'))) |
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
import Data.Monoid | |
data List' a = Nil' | Cons' a (List' a) deriving (Eq, Show) | |
instance Monoid (List' a) where | |
mempty = Nil' | |
mappend x Nil' = x | |
mappend Nil' x = x | |
mappend (Cons' a xs) ys = Cons' a $ xs <> ys |
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
sealed trait Or[A, B] | |
object Or { | |
case class FstA, B extends Or[A, B] | |
case class SndA, B extends Or[A, B] | |
} | |
implicit def eqOr[A: Eq, B: Eq]: Eq[Or[A, B]] = Eq.fromUniversalEquals | |
implicit def arbitraryOrA, B: Arbitrary[Gen[Or[A, B]]] = Arbitrary( | |
Gen.oneOf(Seq(Arbitrary.arbitrary[A].map(Fst()), Arbitrary.arbitrary[B].map(Snd()))) | |
) |
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
import cats.implicits._ | |
def parseInt(s: String): Either[NumberFormatException, Int] = Either.catchOnly[NumberFormatException](s.toInt) | |
List("1", "2", "3").traverse(parseInt) | |
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
fmap (*2) (+1) $ 1 | |
so that returns 4 | |
But why can I not do | |
(fmap (*2) (+)) 1 2 ? |
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
-- Functor for Company a b c | |
data Company a b c = DeepBlue a c | Something b deriving (Eq, Show) | |
instance Functor (Company a b) where | |
fmap f (DeepBlue a c) = DeepBlue a (f c) | |
fmap f (Something b) = Something b | |
instance (Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (Company a b c) where | |
arbitrary = do |
NewerOlder