agda / agda2hs

Compiling Agda code to readable Haskell

Home Page:https://agda.github.io/agda2hs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for deriving strategies

jmchapman opened this issue · comments

module Strategy where

{-# FOREIGN AGDA2HS
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
#-}

open import Data.Bool

record B : Set where
  field b : Bool

{-# COMPILE AGDA2HS B newtype deriving newtype (Eq, Show) #-}

would compile to:

{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

module Strategy where

newtype B = B { b :: Bool }
  deriving newtype (Eq, Show)

Currently trying to compile this produces this strange error:

An internal error has occurred. Please report this as a bug.
Location of the error: __IMPOSSIBLE__, called at src/full/Agda/Utils/FileName.hs:60:20 in Agd-2.6.3-a4d0c165:Agda.Utils.FileName

@omelkonian proposed a workaround in the meantime of using standalone deriving in a FOREIGN block.

Could you give an example of some Haskell code that you would like to be generated by agda2hs?

@jespercockx I updated the description!