2014-07-25 3 views
1

를 찾을 수 없습니다변수이 작동하지 않는 PureScript

itAsync "subscribeEventedOn should receive any attached data" $ \done -> do  
    w <- getWindow 
    subscribeEventedOn "foo" (\event -> do 
    fprint event 
    expect (unwrapDetail event) `toDeepEqual` d' 
    itIs done 
) w 
    emitOn sampleEvent w 
    expect true `toEqual` true 

알 수없는 값을

'W'하지만이 작업을 수행합니다

w <- getWindow 
itAsync "subscribeEventedOn should receive any attached data" $ \done -> do  
    subscribeEventedOn "foo" (\event -> do 
    fprint event 
    expect (unwrapDetail event) `toDeepEqual` d' 
    itIs done 
) w 
    emitOn sampleEvent w 
    expect true `toEqual` true 

이유는 무엇입니까? 이것은 나에게 이해가되지 않는다. (Btw 내 단위 테스트에서 do 블록을 중첩했습니다.)

답변

1

예제 코드에서 이름의 유형을 추측하여이를 재현 할 수 있었고 PureScript 렉서의 특성 때문인 것으로 보입니다. 위의 줄까지 닫기 괄호를 이동하여 문제를 해결할 수 있습니다.

itAsync "subscribeEventedOn should receive any attached data" $ \done -> do  
    w <- getWindow 
    subscribeEventedOn "foo" (\event -> do 
    fprint event 
    expect (unwrapDetail event) `toDeepEqual` d' 
    itIs done) w 
    emitOn sampleEvent w 
    expect true `toEqual` true 
+0

Trippy 내가 문제를 제출하길 원하니? – Fresheyeball

+0

purescript-in-purescript에 구현 된 최신 버전의 렉서로 전환하면 이런 종류의 문제가 해결 될 것으로 판단됩니다. –