A series of exercises to get a feel for how generic types and type variables work in Elm.
For each of these, you are given some code that is not compiling. Your task is to get it
compiling. You can change the body of the function but not the signature. No cheating
with Debug.todo
or infinite recursions either 😉
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 name.anton3.vkapi.generator.json | |
import com.fasterxml.jackson.annotation.JsonUnwrapped | |
import com.fasterxml.jackson.core.JsonParser | |
import com.fasterxml.jackson.databind.* | |
import com.fasterxml.jackson.databind.deser.ContextualDeserializer | |
import com.fasterxml.jackson.databind.deser.ResolvableDeserializer | |
import com.fasterxml.jackson.databind.deser.std.StdDeserializer | |
import com.fasterxml.jackson.databind.node.ObjectNode | |
import com.fasterxml.jackson.databind.node.TreeTraversingParser |
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 arrow.continuations.Effect | |
import arrow.continuations.generic.DelimitedScope | |
import arrow.core.Either | |
import arrow.core.right | |
import com.squareup.sqldelight.TransactionWithReturn | |
import kotlin.coroutines.RestrictsSuspension | |
/** | |
* Either-Syntax for SqlDelight transactions. | |
* |
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 kotlinx.coroutines.experimental.channels.BroadcastChannel | |
import kotlinx.coroutines.experimental.channels.ConflatedBroadcastChannel | |
import kotlinx.coroutines.experimental.channels.ReceiveChannel | |
import kotlinx.coroutines.experimental.channels.filter | |
import kotlinx.coroutines.experimental.channels.map | |
import kotlinx.coroutines.experimental.launch | |
import javax.inject.Inject | |
import javax.inject.Singleton |
Copyright © 2020, Philippe Bastiani.
These are additional notes to this GIST : For-Comprehension Free Monads in Kotlin - Mini Howto.
Disclaimer: This GIST assumes that you are roughly familiar with the concept of Free monad.
Λrrow 0.10 (now deprecated)
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
#!/usr/bin/env stack | |
> -- stack --resolver lts-6 --install-ghc runghc --package classy-prelude --package lens --package wreq | |
Blah Blah words about this single file executable README goes here. | |
> {-# LANGUAGE DeriveAnyClass #-} | |
> {-# LANGUAGE DeriveGeneric #-} | |
> {-# LANGUAGE NoImplicitPrelude #-} | |
> {-# LANGUAGE OverloadedStrings #-} |
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
minikube stop; minikube delete && | |
docker stop $(docker ps -aq) && | |
rm -rf ~/.kube ~/.minikube && | |
sudo rm -rf /usr/local/bin/localkube /usr/local/bin/minikube && | |
launchctl stop '*kubelet*.mount' && | |
launchctl stop localkube.service && | |
launchctl disable localkube.service && | |
sudo rm -rf /etc/kubernetes/ && | |
docker system prune -af --volumes |
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 GADTs #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE OverloadedLabels #-} |
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
(ns example.errors) | |
(defn clean-address [params] | |
"Ensure (params :address) is present" | |
(if (empty? (params :address)) | |
[nil "Please enter your address"] | |
[params nil])) | |
(defn clean-email [params] | |
"Ensure (params :email) matches *@*.*" |
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
;; Get package installation ready | |
(require 'package) | |
(setq package-enable-at-startup nil) | |
(add-to-list 'package-archives | |
'("melpa" . "https://melpa.org/packages/")) | |
(package-initialize) | |
;; Theme | |
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/") | |
(load-theme 'zenburn t) |