nadal Posted February 8, 2014 at 03:56 PM Report #544476 Posted February 8, 2014 at 03:56 PM Tenho o seguinte tipo de dados data ExpInt = Const Int | Mais ExpInt ExpInt Uma vez já feita a intancia para a class show e eq, gostaria de saber como faço a classe Num. Desde já agradeço a ajuda.
pwseo Posted February 8, 2014 at 04:48 PM Report #544480 Posted February 8, 2014 at 04:48 PM Tens apenas de implementar as funções que dizem respeito à classe Num. instance Num ExpInt where (Const a) + (Const b) = Const $ a + b -- ... fromInteger = Const Aqui tens a documentação da classe Num e funções que define: Prelude -- Num Class
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