Pregunta

[Fuente Código]

  

Los datos FooBar = Foo | Bar

[Comando]

  

$ GHC -c foo_bar.hs
  foo_bar.hs: 1: 0: La función 'principal' no está definido en el módulo 'principal'

[Configuración]

  

Glasgow Haskell Compiler, versión 6.12.3, por Haskell 98, etapa 2 arrancado por GHC   Versión 6.10.4

¿Fue útil?

Solución

Se debe definir el tipo en un módulo, y luego compilarlo:

module Test where
data FooBar = Foo | Bar

Al invocar ghc -c foo_bar.hs, la foo_bar.o archivo de objeto será generado sin tener que definir main.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top