upshot Posted January 6, 2016 at 01:33 AM Report Share #591464 Posted January 6, 2016 at 01:33 AM (edited) Boas! Estou a tentar resolver uma função splitFTree :: (FTree a b) -> (BTree a, LTree b) que separa uma árvore com informação nos nodos e nas folhas em duas árvores de tipos diferentes. Sendo os tipos: data FTree a b = Leaf b | No a (FTree a b) (FTree a b) data BTree a = Empty | Node a (BTree a) (BTree a) data LTree a = Tip a | Fork (LTree a) (LTree a) Escrevi a seguinte solução: splitFTree :: (FTree a b) -> (BTree a, LTree b) splitFTree (Leaf a) = ( Node a Empty Empty , Tip a ) splitFTree (No a e d) = let (b1,l1) = splitFTree e (b2,l2) = splitFTree d in (Node a b1 b2 , Fork l1 l2) E não entendo porque recebo o erro solucaoficha9.hs:89:25: parse error in let binding: missing required 'in' Alguém consegue ajudar? Bem-hajam. Edited January 6, 2016 at 01:36 AM by upshot GeSHi Link to comment Share on other sites More sharing options...
pdfrod Posted January 6, 2016 at 11:08 AM Report Share #591478 Posted January 6, 2016 at 11:08 AM (edited) Os bindings dentro de um let devem ter a mesma indentação (Haskell é sensível à indentação). Ou seja, em vez disto: (b1,l1) = splitFTree e (b2,l2) = splitFTree d deveria ser assim: (b1,l1) = splitFTree e (b2,l2) = splitFTree d Edited January 6, 2016 at 11:09 AM by Kimio Link to comment Share on other sites More sharing options...
upshot Posted January 26, 2016 at 12:48 PM Author Report Share #592551 Posted January 26, 2016 at 12:48 PM Era exatamente isso. A única anormalidade era além de parecerem alinhadas, as duas linhas só deixaram de dar erro quando alinhadas por TAB e não por SPACE mesmo estando na mesma "column" da file. Obrigado pela ajuda! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now