data Moore a b = forall r . Moore (r -> b) (r -> a -> r) r | |
data Moore2 a b = Moore2 b (a -> Moore2 a b) | |
l :: Moore2 a b -> Moore a b | |
l machine = L (\(Moore2 state _) -> state) (\(Moore2 _ step) input -> step input) machine | |
r :: Moore a n -> Moore2 a b | |
r (Moore view step state) = Moore2 (view state) (\input -> r $ Moore view step $ step state input) |
-- "Real world examples" | |
-- Ban "data" | |
data Foo = Foo Int a | |
deriving (Eq, Ord, Show, Typeable, Functor, Foldable, Traversable) | |
-- I can't dervive everything! | |
-- Solution I: |
Generate arbitrary modifier (using Arb/CoArb), e.g. a | |
(Set HaskellFilePath -> Vec (NModsPerRound :: Nat) (HaskellFilePathToModify,Modification)) | |
newtype Modification = (UniqueNameForStats, DescrText, Qualifier, HaskellText -> HaskellText) | |
type Qualifier -- info such as: Is this an internal module | |
instance Arbitrary | |
-- Some clever thing here | |
-- E.g. |
QuickRefact is a heuristic refactoring tool inspired by QuickCheck
While QC generates random test cases to prove that your code has errors, QR generates random modifications to your source code and tries to prove that they don't break the code, using your standard compiler and test suite as the verifier. The changes are generated based on a Haskell DSL a la QuickCheck. Each random edit is a random change that will either improve the code without affecting its meaning (in which case it is merged), or break the build (in which case it is rejected).
Basic idea how QR works:
- Start with some Git commit
- Apply some randomly generated changes to the code, then run build/tests
The classics http://hackage.haskell.org/package/extensible-effects http://hackage.haskell.org/package/free http://hackage.haskell.org/package/mtl (http://hackage.haskell.org/package/operational, first freer monad implementation) TODO find link of implementing freer with Free + Free.Ap instead of (Free + left kan)
-- stack resolver: lts-8.21 | |
-- https://ghc.haskell.org/trac/ghc/ticket/3205 | |
{-# LANGUAGE RankNTypes, MultiParamTypeClasses, FlexibleInstances, LambdaCase, ViewPatterns, FlexibleContexts #-} | |
import Control.Monad | |
import Data.Semigroup hiding (Product) | |
import Data.Monoid hiding (Product, (<>)) | |
import Data.Functor.Identity |
# On host machine (e.g. strats1) | |
cd $HOME | |
mkdir $FAKEUSER | |
# The entire env goes in this dir | |
# Junest env $HOME <-> real $HOME/$FAKEUER | |
# Junest env / <-> real $HOME/$FAKEUSER/.junest | |
cd $HOME/$FAKEUSER | |
# Clone strats, junest and hans-conf repos to $HOME/$FAKEUSER | |
# Stable example: | |
# https://github.com/fsquillace/junest, 9cd13c88f6ea7bce144962d97f4f850e5fd5ea07 |
https://www.youtube.com/watch?v=XA2WjJbmmoM | |
https://github.com/neovimhaskell | |
!! https://www.reddit.com/r/haskell/comments/3wiwhs/anyone_using_neovim/ | |
File list | |
Quick cursor movement | |
Autocomplete (not automatic, single key, with options) | |
Multiple clipboards/buffers? | |
Jump to file named (fuzzy search) |