Comments (3)
Hello
same issue with a more complex set of pragmas but no QuasiQuote, rather TemplateHaskell (see code below).
I am using https://github.com/haskell/haskell-ide-engine (0.2.1.0) + the https://github.com/alanz/vscode-hie-server plugin for VSC (0.0.21). I work on a stack generated project (using stack new, stack GHCI 8.4.3).
This is how the error comes.
1- type in the code with the TemplateHaskell commented out : OK
2- uncomment it : this error arises
3- erase the notification : OK
4- make one change in the file (add and remove a space) : GHC Panic
5- erase the notification and perform any change in the code : GHC panic comes again.
Note: at this step, if I use stack ghci
all goes well, the code compiles.
Note: since the error may also partly related to the HIE plugin for VSC, I also filled an issue report here haskell/vscode-haskell#108
code:
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
--{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DataKinds #-}
-- some experiments with dependent types / type-level programming in Haskell
-- references:
-- http://www.parsonsmatt.org/2017/04/26/basic_type_level_programming_in_haskell.html
-- https://www.schoolofhaskell.com/user/konn/prove-your-haskell-for-great-safety/dependent-types-in-haskell
-- https://hackage.haskell.org/package/singletons
module Lib
where
import Prelude hiding (head, tail, zipWith)
import Data.Singletons.TH
someFunc :: IO ()
someFunc = putStrLn "Hello, World!"
singletons
[d|
data Nat = Z
| S Nat
deriving (Show, Eq, Ord)
(+) :: Nat -> Nat -> Nat
Z + x = x
(S n) + x = S (n + x)
(*) :: Nat -> Nat -> Nat
Z * x = Z
(S n) * x = n * x + x
mymin :: Nat -> Nat -> Nat
mymin Z Z = Z
mymin Z (S _) = Z
mymin (S _) Z = Z
mymin (S x) (S y) = S (mymin x y)
|]
data Vector a n where
Nil :: Vector a Z
(:-) :: a -> Vector a n -> Vector a (S n)
infixr 5 :-
deriving instance Eq a => Eq (Vector a n)
toList :: Vector a n -> [a]
toList Nil = []
toList (a :- v) = a : toList v
instance Show a => Show (Vector a n) where
showsPrec p = showsPrec p . toList
append :: Vector a n -> Vector a m -> Vector a (n + m)
append Nil v = v
append (a :- v1) v2 = a :- append v1 v2
head :: Vector a (S n) -> a
head (a :- v) = a
tail :: Vector a (S n) -> a
tail (a :- v) = a
zipWithSame :: (a -> b -> c) -> Vector a n -> Vector b n -> Vector c n
zipWithSame f Nil Nil = Nil
zipWithSame f (a :- v1) (b :- v2) = f a b :- zipWithSame f v1 v2
zipWith :: (a -> b -> c) -> Vector a n -> Vector b m -> Vector c (Mymin n m)
zipWith f Nil Nil = Nil
zipWith f Nil (b :- v) = Nil
zipWith f (a :- v) Nil = Nil
zipWith f (a :- v1) (b :- v2) = f a b :- zipWith f v1 v2
zipSame :: Vector a n -> Vector b n -> Vector (a, b) n
zipSame = zipWithSame (,)
zip :: Vector a n -> Vector b m -> Vector (a, b) (Mymin n m)
zip = zipWith (,)
from ghc-mod.
Sorry but ghc-mod doesn't even support GHC 8.4 yet, you appear to be using haskell-ide-engine's fork of ghc-mod, please report this on their issue tracker since this is most likely related to code that we don't even have in this repo yet :)
If you can reproduce this issue with plain ghc-mod feel free to reopen, however I should point out that we have a test case for QuasiQuotes support: https://github.com/DanielG/ghc-mod/blob/master/test/CheckSpec.hs#L33.
@alanz could you please update the bugreport url in HIE? It's in https://github.com/DanielG/ghc-mod/blob/master/core/GhcMod/Error.hs#L124
from ghc-mod.
Hello @DanielG
I downgraded my project from LTS 12.7 (GHC 8.4.3) to LTS 11.17 (GHC 8.2.2).
Now the hie wrapper uses hie-8.2.2 (and the regular ghc-mod inside) instead of hie-8.4.3 (and the hie forked ghc-mod).
All works well. The issue with TemplateHaskell is no longer there.
(please note the I did not made experiments with QuasiQuotes, which was the initial issue by @goekboet )
I will write an issue in HIE then.
Thanks for the solution. I will continue my journey with dependent types in Haskell using GHC 8.2.2.
Best,
Pascal
from ghc-mod.
Related Issues (20)
- ghc-mod fails with "unknown command: needs-build-output"
- cabal install ghc-mod error HOT 6
- ghc802 branch has 21 failures on Windows HOT 3
- GHC 8.4.1 support HOT 10
- master branch has 21 test failures on Windows
- Type errors in GhcMod.Gap HOT 1
- ghc-mod takes a very long time checking a module with a module annotation HOT 2
- Dynamic linker not initialised HOT 2
- Failing to build ghc-mod with stack HOT 7
- The impossible happened HOT 1
- Not possible to install ghc-mod on Windows HOT 4
- I followed all the instructions mentioned in "Installing ghc-mod" with stack but it had some issues HOT 3
- Panic HOT 1
- Unable to build ghc-mod with the current/recent setup
- DeriveAnyClass language extension
- ghc-mod takes a very long time to check a module using template haskell in a project depending on haskell-src-exts HOT 1
- ghc-mod has parse error on `--*`
- impossible to install ghc-mod for ghc 8.6 HOT 2
- About error of stack install ghc-mod HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ghc-mod.