Created
April 24, 2022 08:45
-
-
Save arsdragonfly/3e7956f5a12e3f4fa6f05b5973b7fcb4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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