Skip to content

Instantly share code, notes, and snippets.

@arsdragonfly
Created April 24, 2022 08:45
Show Gist options
  • Save arsdragonfly/3e7956f5a12e3f4fa6f05b5973b7fcb4 to your computer and use it in GitHub Desktop.
Save arsdragonfly/3e7956f5a12e3f4fa6f05b5973b7fcb4 to your computer and use it in GitHub Desktop.
module Main
import Data.List
data Creep : Type where [external]
data Flag : Type where [external]
moveTo : (HasIO io) => Creep -> Flag -> io ()
moveTo creep flag = pure ()
simpleMove: IO ()
simpleMove = do
creeps <- pure []
flags <- pure []
let firstCreep = head' creeps
let firstFlag = head' flags
-- NOTE: this works
-- let result = (the (Maybe $ IO ()) (moveTo <$> firstCreep <*> firstFlag))
-- pure ()
-- NOTE: this doesn't work because it can't find an implementation for Applicative ?f
let result = (the (Maybe $ IO ()) [| moveTo firstCreep firstFlag |])
pure ()
-- NOTE: this works
-- case (the (Maybe $ IO ()) [| moveTo firstCreep firstFlag |]) of
-- Just _ => pure ()
-- Nothing => pure ()
main : IO ()
main = simpleMove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment