Skip to content

Commit

Permalink
Attempts to run examples
Browse files Browse the repository at this point in the history
  • Loading branch information
alt-romes committed Sep 19, 2023
1 parent fa96e3c commit 0878cbf
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
8 changes: 8 additions & 0 deletions prototype/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ Currently, the only modules that are not outdated with dropped implementations a

Later on we can move them out of the package into an "outdated things" one, but
for now it doesn't matter.

---

Testing:

```
ghc -fdefer-type-errors -fplugin=...
```
18 changes: 18 additions & 0 deletions prototype/app/Main.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
{-# LANGUAGE LinearTypes, UnicodeSyntax, BlockArguments #-}
module Main where


{- Examples from the thesis -}

{- Lets -}

f1 :: (a b) -> a b
f1 use x = let y = use x in y

{- Recursive lets -}

{- Cases -}


-- ROMES:TODO: I have to invoke the linear core plugin directly with the
-- examples, since otherwise compiling Haskell with type errors is not
-- possible, and `-fdefer-type-errors` makes the program useless, only having
-- runtime type errors...
main :: IO ()
main = putStrLn "Hello, Haskell!"
10 changes: 10 additions & 0 deletions prototype/ghc-bugs/Bug.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{-# LANGUAGE LinearTypes #-}
module Bug where

-- f :: a -> b
-- f x = x

f1 :: (a %1 -> b) -> a %1 -> b
f1 use x = let y = use x in y


5 changes: 3 additions & 2 deletions prototype/linear-core-prototype.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ common common
th-abstraction >= 0.6,
recursion-schemes >= 5.2 && < 5.3,
text >= 2.0 && < 2.1,
vector >= 0.13 && < 0.14,
-- vector >= 0.13 && < 0.14,
megaparsec >= 9.4 && < 9.5,
diagnose >= 2.0.0 && < 2.1,
prettyprinter >= 1.7 && < 2,
parser-combinators >= 1.3 && < 2,
ghc >= 9.4,
linear-base

library
import: common
Expand All @@ -48,7 +49,7 @@ library
executable linear-core-prototype
import: common
main-is: Main.hs
other-modules: F
-- other-modules: F
build-depends: linear-core-prototype
hs-source-dirs: app
ghc-options: -dno-typeable-binds -fplugin=Linear.Core.Plugin
Expand Down
2 changes: 1 addition & 1 deletion prototype/src/Linear/Core/Plugin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Using usage environments instead of unrestricted and linear resources (empty UE
* this isn't useful for linear resources, since they would be duplicated
-}

import Data.Functor
import Data.Functor hiding (unzip)
import Data.Void
import Data.Text (Text)
import qualified Data.Text as T
Expand Down

0 comments on commit 0878cbf

Please sign in to comment.