I am attempting to build a CLI interface for a basic app using Haskell and the Brick package. In all examples I have seen (including the documentation), the handleEvent
function has the following type signature, in order to tell Brick to continue or stop execution after the state is updated:
AppState -> BrickEvent n e -> EventM n (Next AppState)
However, for me, my compiler is saying that Next
is not found (nor can I manually export it from the package it is meant to be in, Brick.Main
). The same is true for the continue
function used below.
Minimum reproducible problem:
Main.hs:
module Main where
import Brick.Main
import Brick.Types
import Graphics.Vty.Input.Events
data AppState = AppState deriving (Show, Eq)
handleEvent :: AppState -> BrickEvent n e -> EventM n (Next AppState)
handleEvent s e =
case e of
VtyEvent vtye ->
case vtye of
EvKey (KChar 'q') [] -> halt s
_ -> continue s
_ -> continue s
brick-test.cabal:
cabal-version: 2.4
name: brick-test
version: 0.1.0.0
author: AlexScriba
maintainer: 61542302+AlexScriba@users.noreply.github.com
extra-source-files: CHANGELOG.md
executable brick-test
main-is: Main.hs
build-depends:
base ^>=4.14.3.0,
brick >= 1.7,
vty
hs-source-dirs: app
default-language: Haskell2010
I have tried again in different projects and it seems not to work in any of them. Have also tried with different versions of brick.