Dynamic
데이터 형식을 함수로 입력하고 해당 함수의 구현에 사용하고 싶습니다. 난 getA :: Dynamic -> IO()
할 함수의 특성을 변경하는 경우Haskell 함수의 입력으로 동적 데이터
Could not deduce (b ~ Dynamic)
from the context (Typeable b)
bound by the type signature for getA :: Typeable b => b -> IO()
때문에 오류가 :
getA :: (Typeable b) => b -> IO()
getA t = do
let v = case fromDynamic t of
Nothing -> error "Nao Foi Possível Converter"
Just x -> x
putStrLn "Ok"
이 오류 발생이 함수를 가정
No instance for (Typeable a0) arising from a use of `fromDynamic'
The type variable `a0' is ambiguous
Possible fix: add a type signature that fixes these type variable(s)
어떤 데이터 입력해야 이 경우에 사용합니까?
또한 x
이 인스턴스 인 클래스에서 함수를 호출 할 수 있습니까? 같은 뭔가 : sayHello
이 x
가 인스턴스 인 클래스의 함수이다
case fromDynamic t of
Nothing -> error "Nao Foi Possível Converter"
Just x -> putStrLn$ sayHello x
.