All Downloads are FREE. Search and download functionalities are using the official Maven repository.

arrow.debug.debug.kt Maven / Gradle / Ivy

There is a newer version: 0.10.4
Show newest version
package arrow.debug

import arrow.TC
import arrow.data.Try
import arrow.effects.Async
import arrow.effects.Effect
import arrow.effects.MonadSuspend
import arrow.effects.async
import arrow.mtl.*
import arrow.typeclasses.*
import kotlin.reflect.KClass

inline fun  debugInstanceLookups(): Map, () -> TC> = mapOf(
        Alternative::class to { alternative() },
        Applicative::class to { applicative() },
        ApplicativeError::class to { applicativeError() },
        Bifoldable::class to { bifoldable() },
        Bimonad::class to { bimonad() },
        Comonad::class to { comonad() },
        Eq::class to { eq() },
        Foldable::class to { foldable() },
        Functor::class to { functor() },
        FunctorFilter::class to { functorFilter() },
        Monad::class to { monad() },
        MonadCombine::class to { monadCombine() },
        MonadError::class to { monadError() },
        MonadFilter::class to { monadFilter() },
        MonadReader::class to { monadReader() },
        MonadState::class to { monadState() },
        MonadWriter::class to { monadWriter() },
        Monoid::class to { monoid() },
        MonoidK::class to { monoidK() },
        Reducible::class to { reducible() },
        Semigroup::class to { semigroup() },
        SemigroupK::class to { semigroupK() },
        Traverse::class to { traverse() },
        TraverseFilter::class to { traverse() },
        MonadSuspend::class to { async() },
        Async::class to { async() },
        Effect::class to { async() }
)

inline fun  showInstances(
        debugLookupTable: Map, () -> TC> = debugInstanceLookups()): List =
        debugLookupTable.entries
                .filter { Try { it.value() }.fold({ false }, { true }) }
                .map { it.key.simpleName }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy