-
Notifications
You must be signed in to change notification settings - Fork 71
Closed
Labels
CR:Status:ClosedAdmin only: Change request that has been completedAdmin only: Change request that has been completedCR:Type:BugAdmin only: Change request pertaining to error detectedAdmin only: Change request pertaining to error detected
Milestone
Description
Copilot 3.20 added support for struct updates via the new UpdateField
operation. At the moment, there is no support in the copilot-prettyprinter
package for pretty-printing UpdateField
operations. For example, this means that the following Copilot specification will fail when executed:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE NoImplicitPrelude #-}
module Main (main) where
import Data.Foldable (for_)
import Data.Functor (void)
import Data.Word (Word32)
import qualified Copilot.PrettyPrint as PP
import Language.Copilot
data S = S
{ unS :: Field "unS" Word32
}
instance Struct S where
typeName _ = "s"
toValues s = [Value typeOf (unS s)]
instance Typed S where
typeOf = Struct (S (Field 0))
spec :: Spec
spec = do
let externS :: Stream S
externS = extern "extern_s" Nothing
example :: Stream Word32
example = (externS ## unS =: 42) # unS
trigger "example" (example == example) [arg externS, arg example]
main :: IO ()
main = do
spec' <- reify spec
putStrLn $ PP.prettyPrint spec'
$ runghc UpdateFieldPP.hs
UpdateFieldPP.hs: src/Copilot/PrettyPrint.hs:(79,12)-(102,31): Non-exhaustive patterns in case
I have a prototype fix available in this branch, which could be used as a starting point for a patch.
Metadata
Metadata
Assignees
Labels
CR:Status:ClosedAdmin only: Change request that has been completedAdmin only: Change request that has been completedCR:Type:BugAdmin only: Change request pertaining to error detectedAdmin only: Change request pertaining to error detected