10
저는 haskell에서 Ubigraph를 사용하려고 노력하고 있습니다.하지만 제 문제는 좀 더 일반적이라고 생각합니다. 내가 컴파일하려고 해요 :하스켈에서 모나드 혼합하기
import Graphics.Ubigraph
import Control.Monad
import System.Posix.Unistd
main = do
h <- initHubigraph "http://127.0.0.1:20738/RPC2"
runHubigraph op h
op = do
clear
vs <- mapM (const newVertex) [0..200]
mapM_ (setVAttr (VShape Sphere)) vs
putStrLn "something"
let bind i = zipWithM (\a b -> newEdge (a,b)) vs (drop i vs ++ take i vs)
mapM_ bind [1..15]
mapM_ (removeVertex) vs
return()
을 내가 얻고
내가 연산의 종류가 putStrLn의 반환 형식과 다른 무언가로 암시되는 방법을 볼 수 있습니다
Couldn't match expected type `Control.Monad.Trans.Reader.ReaderT
Ubigraph IO a0'
with actual type `IO()'
In the return type of a call of `putStrLn'
In a stmt of a 'do' expression: putStrLn "something"
In the expression:
do { clear;
vs <- mapM (const newVertex) [0 .. 200];
mapM_ (setVAttr (VShape Sphere)) vs;
putStrLn "something";
.... }
, 그러나 나는이 코드를 어떻게 적절하게 컴파일하기 위해 리엔지니어링을 할 것인지 잘 모르겠습니다. op 함수의 반환 유형을 간단히 변경할 수 있습니까?
감사
는
멋진 작품. 빠른 답변 감사합니다 –