Usage of Sigma adds an incorrect import and forgets brackets
sarajuhosova opened this issue · comments
Sára Juhošová commented
If we write the following Agda code:
module Sigma where
open import Haskell.Prelude
open import Haskell.Extra.Sigma
sigmaMaybe : Maybe (Σ[ x ∈ String ] Int)
sigmaMaybe = return ("hello" , 1)
{-# COMPILE AGDA2HS sigmaMaybe #-}
sigmaDo : Maybe Int
sigmaDo = do
_ , i ← sigmaMaybe
return i
{-# COMPILE AGDA2HS sigmaDo #-}
sigmaCase : Σ[ x ∈ a ] b → a
sigmaCase s = case s of λ where (fs , sn) → fs
{-# COMPILE AGDA2HS sigmaCase #-}
This will result in the following incorrect Haskell:
module Sigma where
import Haskell.Extra.Sigma (Σ((,)))
sigmaMaybe :: Maybe (String, Int)
sigmaMaybe = return ("hello", 1)
sigmaDo :: Maybe Int
sigmaDo
= do _ , i <- sigmaMaybe
return i
sigmaCase :: (a, b) -> a
sigmaCase s
= case s of
fs , sn -> fs
- The
import Haskell.Extra.Sigma (Σ((,)))
shouldn't be there. - The
_ , i <- sigmaMaybe
is missing brackets around(_ , i)
- The
fs , sn -> fs
is missing brackets around(fs , sn)