Skip to content

Instantly share code, notes, and snippets.

View funrep's full-sized avatar

Karl-Oskar Rikås funrep

View GitHub Profile
module Main where
import Text.ParserCombinators.Parsec
import Control.Monad.Error
import System.Environment
main = do
expr <- getArgs >>= readExpr . head
putStrLn $ show $ eval expr
module Main where
import Text.ParserCombinators.Parsec
import Control.Monad.Error
import System.Environment
main = getArgs >>= putStrLn . readExpr . head
-- Parser
module Main where
import Text.ParserCombinators.Parsec
import Control.Monad.Error
import System.Environment
main = getArgs >>= putStrLn . readExpr . head
-- Parser
Warning: The package list for 'hackage.haskell.org' is 18 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Configuring lisp-0.1.0.0...
Building lisp-0.1.0.0...
Preprocessing executable 'lisp' for lisp-0.1.0.0...
[1 of 1] Compiling Main ( Main.hs, dist/build/lisp/lisp-tmp/Main.o )
Main.hs:20:6:
Unexpected semi-colons in conditional:
@funrep
funrep / Client.hs
Last active December 16, 2015 13:58
module Client where
import Network
import System.IO
runClient :: HostName -> PortNumber -> IO ()
runClient ip port = do
h <- connectTo ip $ PortNumber port
putStrLn $ show h
listen h
module Main where
import System.Environment
import System.IO
import Control.Monad (unless)
import Server
import Client
test :: HandlerFunc

Vilhelm Moberg

  • Mest känd för bokserien Utvandrarna
  • Född och uppväxt i Småland
  • Började skriva i ung ålder, vann pris när han var 13
  • Han skrev även pjäser
  • Har bott i amerika flera gånger, men emigrerade aldrig
  • Debatterade mycket för sin åsikt som republikan
  • Efter lång tid av depression dränkte han sig själv
module Main where
import System.Environment
import Text.ParserCombinators.Parsec hiding (spaces)
import Control.Monad.Error
main :: IO ()
main = do
input <- getLine
evaled <- return $ fmap show $ readExpr input >>= eval
Main.hs:99:23:
No instance for (MonadError
(String -> LispVal -> LispError) ((->) [Char]))
arising from a use of `throwError'
Possible fix:
add an instance declaration for
(MonadError (String -> LispVal -> LispError) ((->) [Char]))
In the expression: throwError TypeMismatch "boolean" result
In a case alternative:
otherwise -> throwError TypeMismatch "boolean" result
isPal :: Eq a => [a] -> Bool
isPal [] = True
isPal xs = if (head xs) /= (last xs) then False
else if (head xs) == (last xs) then isPal $ drop 1 (init xs)
else True