Skip to content

Instantly share code, notes, and snippets.

View liarokapisv's full-sized avatar

Liarokapis Alexandros liarokapisv

View GitHub Profile
@liarokapisv
liarokapisv / ordering.sql
Created September 26, 2017 14:17
Best Practice
select RV.name, MV.title, RT.stars, RT.ratingDate
from (select * from Reviewer) as RV join
(select * from Movie) as MV join
(select * from Rating) as RT on
(RV.rId = RT.rId and RT.mId = MV.mId)
order by RV.name asc, MV.title asc, RT.stars asc
@liarokapisv
liarokapisv / dependent.hs
Last active December 11, 2017 15:15
Problem with singletons
import Data.Singletons.Decide
import Data.Singletons.TH
import Data.Kind
@liarokapisv
liarokapisv / SParser.idr
Created January 4, 2018 17:31
State over Grammar
module Danac.Parser
import Danac.Lexer
import Text.Lexer
import Text.Parser
data SParser : Type -> Type -> Bool -> Type -> Type where
MkSParser : (s -> Grammar t c (a, s)) -> SParser s t c a
Functor (SParser s t b) where
@liarokapisv
liarokapisv / Grammar.idr
Last active January 4, 2018 18:03
Grammar stack overflow
module Test
import Text.Lexer
import Text.Parser
data Token : Type where
AddOp : Token
MulOp : Token
IntConst : Token
@liarokapisv
liarokapisv / Test.idr
Created January 6, 2018 12:23
Case split
module Test
record Ann where
constructor MkAnn
ann1 : Type
@liarokapisv
liarokapisv / Test.idr
Last active January 7, 2018 23:24
Show implementation not total
module Test
%default total
data Box : Type -> Type where
MkBox : t -> Box t
data Test : Type where
T1 : Test
T2 : Box Test -> Test
mutual
renameFuncCall : AnnFuncCall ParserAnn -> Renamer (AnnFuncCall RenamerAnn)
renameFuncCall ((MkFuncCall x xs) .+. y) = [| [| MkFuncCall (renameIdentifier Func x)
(traverse renameExpr xs) |] .+. [|y|] |]
renameExpr : AnnExpr ParserAnn -> Renamer (AnnExpr RenamerAnn)
renameExpr ((IntConst x) .+. y) = [| [| IntConst (renameIntConst x) |] .+. [|y|] |]
renameExpr ((CharConst x) .+. y) = [| [| CharConst (renameCharConst x) |] .+. [|y|] |]
renameExpr ((Lvalue x) .+. y) = [| [| Lvalue (renameLvalue x) |] .+. [|y|] |]
@liarokapisv
liarokapisv / Errors
Created March 11, 2018 20:39
Error handling
data A
data A'
data B
data B'
data C
data C'
data ExtraX
import game.PlayerModel;
import game.PlayerView;
import game.Player;
import game.GameState;
import java.util.Map;
public class PlayerController
{
public class PlayerController(Map<Player, PlayerModel> modelMap, Map<Player, PlayerView> viewMap)
@liarokapisv
liarokapisv / bt.hs
Created July 5, 2020 15:21
Foldables vs Recursion Schemes
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
import Data.Functor.Foldable
import Data.Functor.Foldable.TH