Compare commits
No commits in common. "a8ec2f9f2189e7109422b3d2e3f75e7b6373852d" and "04f48fe0eea282c2f1fbc95b4f2f1d06165c7954" have entirely different histories.
a8ec2f9f21
...
04f48fe0ee
19
.kakrc
19
.kakrc
|
|
@ -1,10 +1,9 @@
|
||||||
set global makecmd 'cabal build'
|
hook -once -group eoc global KakBegin .* %{
|
||||||
#hook -once -group eoc global KakBegin .* %{
|
repl-buffer-new racket -i
|
||||||
# repl-buffer-new racket -i
|
repl-buffer-send-text "(require xrepl)
|
||||||
# repl-buffer-send-text "(require xrepl)
|
"
|
||||||
#"
|
%}
|
||||||
#%}
|
|
||||||
#
|
define-command xrepl-enter %{
|
||||||
#define-command xrepl-enter %{
|
repl-buffer-send-text ",en %val{buffile}"
|
||||||
# repl-buffer-send-text ",en %val{buffile}"
|
}
|
||||||
#}
|
|
||||||
|
|
|
||||||
46
Main.hs
46
Main.hs
|
|
@ -1,46 +0,0 @@
|
||||||
module Main where
|
|
||||||
|
|
||||||
import Data.Aeson (FromJSON, parseJSON, withObject, withText, (.:), decode)
|
|
||||||
|
|
||||||
data Program = Program { programFns :: [Function] }
|
|
||||||
deriving (Show)
|
|
||||||
|
|
||||||
data Function = Function {
|
|
||||||
functionName :: String,
|
|
||||||
returnType :: Maybe Type,
|
|
||||||
functionArgs :: [FunctionArg]
|
|
||||||
} deriving (Show)
|
|
||||||
|
|
||||||
data Type = Int | Bool
|
|
||||||
deriving (Show)
|
|
||||||
|
|
||||||
data FunctionArg = FunctionArg {
|
|
||||||
argName :: String,
|
|
||||||
argType :: Type
|
|
||||||
} deriving (Show)
|
|
||||||
|
|
||||||
instance FromJSON Program where
|
|
||||||
parseJSON = withObject "Program" $ \v -> Program
|
|
||||||
<$> v .: "functions"
|
|
||||||
|
|
||||||
instance FromJSON Function where
|
|
||||||
parseJSON = withObject "Function" $ \v -> Function
|
|
||||||
<$> v .: "name"
|
|
||||||
<*> v .: "type"
|
|
||||||
<*> v .: "args"
|
|
||||||
|
|
||||||
instance FromJSON FunctionArg where
|
|
||||||
parseJSON = withObject "FunctionArg" $ \v -> FunctionArg
|
|
||||||
<$> v .: "name"
|
|
||||||
<*> v .: "type"
|
|
||||||
|
|
||||||
instance FromJSON Type where
|
|
||||||
parseJSON = withText "Type" $ \v ->
|
|
||||||
case v of
|
|
||||||
"int" -> return Int
|
|
||||||
"bool" -> return Bool
|
|
||||||
_ -> fail "wrong type"
|
|
||||||
|
|
||||||
main :: IO ()
|
|
||||||
main = do
|
|
||||||
putStrLn $ show (decode "int" :: Maybe Type)
|
|
||||||
28
eoc.cabal
28
eoc.cabal
|
|
@ -1,28 +0,0 @@
|
||||||
cabal-version: >=1.10
|
|
||||||
-- Initial package description 'eoc.cabal' generated by 'cabal init'. For
|
|
||||||
-- further documentation, see http://haskell.org/cabal/users-guide/
|
|
||||||
|
|
||||||
name: eoc
|
|
||||||
version: 0.1.0.0
|
|
||||||
-- synopsis:
|
|
||||||
-- description:
|
|
||||||
-- bug-reports:
|
|
||||||
-- license:
|
|
||||||
license-file: LICENSE
|
|
||||||
author: Enrico Lumetti
|
|
||||||
maintainer: enrico.lumetti@gmail.com
|
|
||||||
-- copyright:
|
|
||||||
-- category:
|
|
||||||
build-type: Simple
|
|
||||||
extra-source-files: README.md
|
|
||||||
|
|
||||||
executable eoc
|
|
||||||
main-is: Main.hs
|
|
||||||
-- other-modules:
|
|
||||||
-- other-extensions:
|
|
||||||
build-depends:
|
|
||||||
base >=4.13 && <4.14,
|
|
||||||
aeson >= 2.2
|
|
||||||
-- hs-source-dirs:
|
|
||||||
default-language: Haskell2010
|
|
||||||
default-extensions: DeriveGeneric, OverloadedStrings
|
|
||||||
Loading…
Reference in New Issue