I hereby claim:
- I am soareschen on github.
- I am soareschen (https://keybase.io/soareschen) on keybase.
- I have a public key ASBFlptlH9b-PeBx6_1vQOQoQ-_rUPKhr-kSRwSkf4znswo
To claim this, I am signing this object:
// This is an example of how the Scala cake pattern can be used in CGP, | |
// following the example at https://www.baeldung.com/scala/cake-pattern | |
pub mod traits { | |
use std::collections::BTreeMap; | |
use anyhow::Error; | |
use cgp::prelude::*; | |
// For simplicity of the example, we use `dyn` trait to represent test cases |
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHVMj2JxwEJc8zpHLSD3T1memwQ/tkCJk5Rf2zseCvpv soares@soares-desktop |
I hereby claim:
To claim this, I am signing this object:
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE ImplicitParams #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
import GHC.Exts | |
-- Dict Typing - Duck Typing in Haskell using dictionaries and implicits |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ImplicitParams #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
import GHC.Exts | |
-- A handler holds a function that takes in any a that | |
-- satisfies constraint p. Note that we are simply returning | |
-- string in here for the sake of simplifying the demo. |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE ExplicitForAll #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} |
module Main where | |
import Prelude | |
import Data.Record | |
import Control.Monad.Eff (Eff) | |
import Control.Monad.Eff.Console (CONSOLE, log) | |
fooHandler :: forall r. { foo :: String | r } -> String | |
fooHandler args = "(foo-handler " <> args.foo <> ")" |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE DuplicateRecordFields #-} | |
{-# LANGUAGE FunctionalDependencies #-} |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ExplicitForAll #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE AllowAmbiguousTypes #-} | |
import GHC.Exts |
/* | |
This code snippet demonstrates how to do metaprogramming | |
in JavaScript using proxy and with statement. | |
Run this in non-strict mode. | |
*/ | |
const proxy = new Proxy({}, { | |
get(target, key) { | |
if(key === Symbol.unscopables) return {} | |
return `${key.toUpperCase()} ` | |
}, |