This file contains hidden or 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
{-| | |
-- dependencies: | |
-- - base >= 4.7 && < 5 | |
-- - validity | |
-- - hspec | |
-- - genvalidity | |
-- - genvalidity-hspec | |
-} | |
{-# LANGUAGE DeriveGeneric #-} |
This file contains hidden or 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
import Control.Exception | |
import Control.Monad (forever, void) | |
import Data.Char (toUpper) | |
import GHC.IO.Handle.FD (fdToHandle) | |
import Prelude | |
import System.Exit | |
import System.IO (BufferMode (..), hGetLine, hPrint, | |
hPutStrLn, hSetBuffering, hClose) | |
import System.Posix.Process (exitImmediately, forkProcess) | |
import System.Process (createPipe, createPipeFd) |
This file contains hidden or 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 IPC where | |
import Control.Monad (forever) | |
import Data.Char (toUpper) | |
import GHC.IO.Handle.FD (fdToHandle) | |
import Prelude | |
import System.IO (BufferMode (..), hGetLine, hPrint, | |
hPutStrLn, hSetBuffering) | |
import System.Posix.Process (forkProcess) | |
import System.Process (createPipeFd) |
This file contains hidden or 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 Parser.Test where | |
import RIO hiding (try, (<|>)) | |
import Text.ParserCombinators.Parsec | |
data Block = List [Block] | ListItem String | |
deriving Show | |
-- | Parser for 'BulletPoint' |
This file contains hidden or 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 OverloadedStrings #-} | |
module TestScrapbox where | |
import Data.Maybe (isJust) | |
import Data.String (fromString) | |
import Data.Text (Text) | |
import qualified Data.Text as T | |
import Text.ParserCombinators.Parsec |
This file contains hidden or 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 OverloadedStrings #-} | |
module Table where | |
import Control.Monad | |
import Data.Attoparsec.Text as P | |
import Data.Text (Text) | |
import qualified Data.Text as T | |
data Table = Table [Column] |
This file contains hidden or 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
Markdown | |
[ Document ( ScrapText [ Context NoStyle [ SimpleText "Get started" ] ] ) | |
, Thumbnail ( Url "https://gyazo.com/5f93e65a3b979ae5333aca4f32600611" ) | |
, Document ( ScrapText [ Context NoStyle [ SimpleText "Welcome to your new Scrapbox project!" ] ] ) | |
, BreakLine | |
, Header ( HeaderSize 2 ) [ SimpleText "📝 Everything is editable" ] | |
, BreakLine | |
, BulletLine ( BulletSize 1 ) ( ScrapText [ Context NoStyle [ SimpleText "Click on any line and start typing to edit. " ] ] ) | |
, BreakLine | |
, BulletLine ( BulletSize 2 ) ( ScrapText [ Context NoStyle [ SimpleText "Press tab at the beginning of a line to indent and add a bullet point." ] ] ) |
This file contains hidden or 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
Markdown | |
{ getMarkdown = | |
[ Simple | |
( ScrapText | |
{ getScrapText = | |
[ Scrap | |
{ scrapStyle = NoStyle | |
, scrapContent = [ PlainText "Get started" ] | |
} | |
] |
This file contains hidden or 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
import Dhall (Interpret (..), Inject(..)) | |
import qualified Dhall as D | |
import Dhall.Core (pretty) | |
import qualified Data.Text as T | |
import GHC.Generics | |
import Control.Monad.Trans.State.Strict (evalState) | |
import Data.Functor.Contravariant | |
data Person = Person { | |
pName :: !Text |
This file contains hidden or 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
-- |A @'Trie' a b@ is a map with keys of type @[a]@ and values of type @b@. | |
data Trie a b = Fork (Maybe b) (Map a (Trie a b)) | |
deriving (Show, Eq) | |
instance (Ord a, Arbitrary a, Arbitrary b) => Arbitrary (Trie a b) where | |
arbitrary :: Gen (Trie a b) | |
arbitrary = sized $ \n -> if n == 0 -- We interpret the size n as maximum number of values | |
-- stored in the trie. | |
then return empty -- If the n == 0, the trie must be empty. |