Jump to content

parse error in let binding: missing required 'in'


Recommended Posts


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

parse error in let binding: missing required 'in'

Alguém consegue ajudar?


Edited by upshot
Link to comment
Share on other sites

  • 3 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.