- Location: Dubai, UAE
- Phone: +971586924747
- Email: [email protected]
- LinkedIn: linkedin.com/in/graninas
- GitHub: github.com/graninas
- Languages: Russian (Native), English (Fluent)
- Location: Dubai, UAE
- Phone: +971586924747
- Email: [email protected]
- LinkedIn: linkedin.com/in/graninas
- GitHub: github.com/graninas
- Languages: Russian (Native), English (Fluent)
- Location: Dubai, UAE
- Phone: +971586924747
- Email: [email protected]
- LinkedIn: linkedin.com/in/graninas
- GitHub: github.com/graninas
- Languages: Russian (Native), English (Fluent)
- Location: Dubai, UAE
- Phone: +971586924747
- Email: [email protected]
- LinkedIn: linkedin.com/in/graninas
- GitHub: github.com/graninas
- Languages: Russian (Native), English (Fluent)
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 #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
module Main 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
(* Free monads in OCaml | |
Code for my talk: | |
https://www.youtube.com/live/KdMuSH9pGsw?si=wybc5UCBua-uIzBU | |
*) | |
(* Free monads are implemented with the help of these resourses: *) | |
(*http://rgrinberg.com/posts/free-monads-in-the-wild-ocaml/*) |
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 StateLangSpec where | |
import Test.Hspec | |
import Data.IORef | |
import Control.Monad.Free.Church | |
data StateMethod s next | |
= Put s (() -> next) | |
| Get (s -> next) |
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
-- Option 1: State as an eDSL | |
data StateMethod s next | |
= Put s (() -> next) | |
| Get (s -> next) | |
instance Functor (StateMethod s) where | |
fmap f (Put st next) = Put st (f . next) | |
fmap f (Get next) = Get (f . next) |
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 is an idea of how to merge the State monad and the Church Free monad | |
# without interferring with the inner eDSL. | |
# This code is incomplete and requires a further development. | |
# The idea is that we pass the state around with the Church Free functions | |
# as we would do it with a regular State monad. | |
# The overal concept is based on my Free monadic STM implementation: | |
# https://github.com/graninas/cpp_stm_free |
NewerOlder