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
// Here's an example of how to return a state flow from the composable. | |
fun <A, B> buildComposeViewForm( | |
context: Context, | |
content: @Composable ViewScope.(A) -> B, | |
initialValue: A | |
): Pair<View, StateFlow<B>> { | |
val root = LinearLayout(context) |
This file has been truncated, but you can view the full file.
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
this derivation will be built: | |
/nix/store/hrgl9q3hcmf4nzfqf8b30mgx2ij63wnj-gdal-3.4.2.drv | |
building '/nix/store/hrgl9q3hcmf4nzfqf8b30mgx2ij63wnj-gdal-3.4.2.drv'... | |
Sourcing pytest-check-hook | |
Using pytestCheckPhase | |
unpacking sources | |
unpacking source archive /nix/store/cajis01pxh1dx0cxkpjsr7gbfyzm8bfz-source | |
source root is source/gdal | |
patching sources | |
autoreconfPhase |
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
package com.myorg.myapp.api | |
data class AlbumData( | |
val title: String, | |
val released: DateTime, | |
val artist: String | |
) | |
interface AlbumService { | |
suspend fun getAlbums(): List<AlbumData> |
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
{-# LANGUAGE DataKinds, KindSignatures, TypeOperators, TypeFamilies #-} | |
module Main where | |
{- | |
Fun with graded categories and lattices: Enforcing the | |
Clean Architecute at compile time. | |
Alternate sub-title: | |
Certified clean, seven days a week |
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
-- class KComonad m w where | |
-- extractM :: w a -> m a | |
-- extendM :: (w a -> m b) -> w a -> m (w b) | |
-- duplicateM :: w a -> m (w (w a)) | |
-- A variation on the Moore comonad | |
-- that allows for a termination condition. | |
-- Q: What kind of structure is this? | |
-- I think this is a monadic comonad with additional |
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
List(Assets.Clips.NpcUp, Assets.Clips.NpcDown, Assets.Clips.NpcLeft, Assets.Clips.NpcRight) | |
.traverse(assetName => for | |
json <- assetCollection.findTextDataByName(assetName) | |
sprite <- Json.asepriteFromJson(json) | |
res <- sprite.toClips(assetName) | |
yield res | |
) |
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
def test(player1: Player, player2: Player) = gameAction { | |
transaction( | |
give = MyItem, | |
from = player1, | |
to = player2 | |
) | |
startDialog { | |
speak(player1, "Thanks a lot!") | |
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
// | |
// Example of what non-"Type" kinded HKTs might look like in | |
// Kotlin with support for HKTs via a compiler plugin | |
// | |
sealed interface Nat<N: Nat<N>> | |
data class S<N: Nat<N>>(val pred: N): Nat<S<N>> | |
object Z: Nat<Z> |
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
// Example serializable trait to mimic | |
// Kotlin @Serializable behavior from | |
// kotlinx serialization. | |
trait Serializable[A]: | |
def serialize(x: A): String | |
def deserialize(raw: String): Option[A] | |
class MyClass(val x: Int) |
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
// | |
// Comonads.cpp: Comonads in C++ | |
// | |
// Author: Nathan Bedell | |
// | |
// | |
// "Your scientists were so preoccupied with whether or not they could, they didn't stop | |
// to think if they should." | |
// |
NewerOlder