Skip to content

Instantly share code, notes, and snippets.

View Lev135's full-sized avatar
๐Ÿ“š
Studying mathematics

Lev Dvorkin Lev135

๐Ÿ“š
Studying mathematics
  • 12:47 (UTC +03:00)
View GitHub Profile
@Lev135
Lev135 / Main.hs
Created August 5, 2022 07:28
'mtl' classes with mappable errors
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wall #-}
{-# OPTIONS_GHC -Wno-partial-type-signatures #-}
@Lev135
Lev135 / Main.hs
Created July 25, 2022 19:10
Debugging megaparsec transofrmer using `MonadParsecDbg` class
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-- | This module contains usage example of suggested `MonadParsecDbg` type class,
-- minimized, but, I hope, demonstrative
--
-- If someone have better solution, I would like to see it
module Main where
@Lev135
Lev135 / LookAhead.hs
Created July 20, 2022 12:59
Check if every list composed from the set of patterns can be uniquely decomposed into patterns using Sardinas-Peterson's algorithm
module LookAhead
( Pattern (..),
ConflictPatterns,
checkUniquePatSplit,
checkUniquePatSplit',
)
where
import Control.Monad (guard, when)
import Data.Bifunctor (Bifunctor (..))
@Lev135
Lev135 / Main.hs
Created June 28, 2022 16:38
Unordered applicative
{-# LANGUAGE ApplicativeDo #-}
module Main where
import Data.Void (Void)
import Text.Megaparsec (Parsec, parseTest)
import Text.Megaparsec.Char (char)
import Text.Megaparsec.Char.Lexer (decimal)
import UnordApp (liftApp, runUnord)