Skip to content

Instantly share code, notes, and snippets.

package org.jparsec.examples.dsl;
import org.jparsec.Parser;
import org.jparsec.Parsers;
import org.jparsec.Scanners;
import org.jparsec.Terminals;
import java.util.Arrays;
public class DSL {
||| A proof of the validity of matching algorithm for
||| regular expressions
|||
||| From https://arxiv.org/abs/2003.06458
module re
%default total
infix 7 .|
infix 6 ..
{-# LANGUAGE DeriveDataTypeable, DeriveGeneric, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, PolyKinds,
ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-}
module Gorilla.Auth.Roles where
import Control.Monad.Trans (liftIO)
import Control.Monad.Trans.Except (runExceptT)
import Data.Proxy (Proxy (Proxy))
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import Network.Wai (Request)
@abailly
abailly / Parking.idr
Last active March 18, 2019 15:04
A first cut at modelling Parking fare problem
||| From Slack ADL: https://artisans-du-logiciel.slack.com/files/UA67NMTA6/FH0UVDUAX/tarif_parking.jpg
||| Goal is to "embed" the business rules for computing parking durations inside Idris,
||| computing a pricing expression as the type of a given duration
module Parking
import Data.List
mutual
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-|
@abailly
abailly / Db.hs
Created July 15, 2018 11:58
Overriding standard generator with custom ones (along the line of https://scastie.scala-lang.org/0MGUDt4AQbyEwPl7k0KnYQ)
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE StandaloneDeriving #-}
module Db where
import Data.List (intersperse)
@abailly
abailly / Wrapper.hs
Created May 25, 2018 16:24
Singletons-like type to value association
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
import Protolude
data Tag = Foo | Bar
data RTag (t :: Tag) where
@abailly
abailly / EffServer.hs
Created May 8, 2018 08:18
A sample Servant + freer Effects server
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
{-| Sample code struggling with reader Eff
uses code from https://github.com/TaktInc/freer
-}
import Control.Monad.Operational
import Data.Dynamic
import Data.Reify
import Protolude
data Prog i a f = Val a
| Step f f

Keybase proof

I hereby claim:

  • I am abailly on github.
  • I am arnaudbailly (https://keybase.io/arnaudbailly) on keybase.
  • I have a public key ASAaHgUGHeyZ51vsNSmzovlbDyL-9tU2PzOECjCUdW4NKAo

To claim this, I am signing this object: