packages feed

Frank (empty) → 0.0

raw patch · 4 files changed

+135/−0 lines, 4 filesdep +basedep +mtldep +newtypesetup-changed

Dependencies added: base, mtl, newtype, she, void

Files

+ Frank.cabal view
@@ -0,0 +1,25 @@+name:		Frank+version:	0.0+synopsis:	An experimental programming language with typed algebraic effects+description:	An experimental programming language with typed algebraic effects+license:	PublicDomain+author:		Conor McBride+build-type:	Simple+cabal-version:	>= 1.8+homepage:	http://personal.cis.strath.ac.uk/~conor/pub/Frank/+stability:	experimental+category:	Languages+license-file:	LICENCE+maintainer:	conor@strictlypositive.org++executable frank+  main-is:		Main.lhs+  build-depends:	base < 5, void, newtype, mtl, she+  extensions:		TypeOperators, KindSignatures, GADTs, TypeSynonymInstances, FlexibleInstances, GeneralizedNewtypeDeriving, TupleSections, FunctionalDependencies, PatternGuards+  ghc-options:		-F -pgmF she++source-repository head+  type:		  darcs+  location:	  http://personal.cis.strath.ac.uk/~conor/pub/Frank/++
+ LICENCE view
@@ -0,0 +1,5 @@+FRANK is written by Conor McBride.++Permission is hereby granted, free of charge, to any person obtaining this work (the "Work"), to deal in the Work without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Work, and to permit persons to whom the Work is furnished to do so.++THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS IN THE WORK. 
+ Main.lhs view
@@ -0,0 +1,102 @@+> {-# OPTIONS_GHC -F -pgmF she #-}+> {-# LANGUAGE TypeOperators, KindSignatures, GADTs, TypeSynonymInstances,+>     FlexibleInstances, GeneralizedNewtypeDeriving, TupleSections,+>     MultiParamTypeClasses #-}++%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%++> module Main where++%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%++> import Prelude hiding (elem, all)+> import Data.Char+> import Data.List hiding (elem, all)+> import Data.Monoid+> import Data.Foldable+> import Data.Traversable+> import Control.Applicative+> import Control.Monad+> import Control.Newtype+> import Data.Void+> import Control.Arrow+> import System.Environment+> import System.IO++> import Gubbins+> import Types+> import Pa+> import Syntax+> import Unify+> import Template+> import Check+> import ElabMonad+> import Elab+> import Run+++%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+%%%%% Line Checking                                                      %%%%%+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+++> lineCh :: ([Pat], Raw) -> ElabM (Template, ([PAT], TM {CHK}))+> lineCh l@(ps, r) = err (Line l) $ do+>   ((f, (i, (g, ps))), (ss, v)) <- lhsCh ps+>   t <- cxLocal g (withSigs ss (checkR v r))+>   return (f, (ps, t))++> lhsCh :: [Pat] -> ElabM ((Template, (Int, (Bwd Entry, [PAT]))), ([Sig], VT))+> lhsCh ps = patTree ps [] >>= \ t -> do+>   info <- getInfoE+>   case t of+>     TLeaf _ _ -> moanE $ BadLhs ps+>     TNode f ts -> case lookup f (funDecls info) of+>       Nothing -> moanE $ BadLhs ps+>       Just (i, vs, sa, v) -> do+>         ss <- getSigsE+>         gp <- ttpsCh f (map (`sAct` ss) vs) ts+>         return ((f, (i, gp)), (sAct sa ss, sAct v ss))++Must check coverage!+++> makeDefs :: Source -> Either TError [(Template, VAL)]+> makeDefs src = case moc (typeInfo src) of+>   Left (e :? _) -> Left e+>   Right info -> do+>     tpes <- baseInfo info (traverse lineCh (sourceDefs src))+>     let fs = [ (t, [pes | (u, pes) <- tpes, t == u])+>              | (t, _) <- funDecls info+>              ]+>     let defs = primitiveDefs +++>                map (\ (t, pes) -> (t, VU (lambda defs [] pes))) fs+>     return defs+++> frank :: String -> IO ()+> frank s =+>   let src = source s in do+>     case sourceJunk src of+>       [] -> return ()+>       x -> putStrLn "Syntax Errors!" >> print x+>     case makeDefs src of+>       Left e -> putStrLn $ show e+>       Right defs -> putStrLn =<<+>         display (eval defs [] (H (FN [Mark "main"]) :/ []))++> main :: IO ()+> main = do+>   hSetBuffering stdout NoBuffering+>   hSetBuffering stdin NoBuffering+>   hSetEcho stdin False+>   args <- getArgs+>   case args of+>     [] -> frank =<< getContents+>     (f : _) -> do+>       frank =<< readFile (if elem '.' f then f else f ++ ".fk")+>       return ()++
+ Setup.lhs view
@@ -0,0 +1,3 @@+#!/usr/bin/env runhaskell+> import Distribution.Simple+> main = defaultMain