{-- JVM-Bridge -- bridge from FP languages and others to the Java VM Copyright (C) 2001 Ashley Yakeley This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --} module Platform.JavaVM.Types.Witness where { import Platform.JavaVM.Types.Types; import Data.Witness; data PrimitiveType t where { Tboolean :: PrimitiveType Jboolean; Tbyte :: PrimitiveType Jbyte; Tchar :: PrimitiveType Jchar; Tshort :: PrimitiveType Jshort; Tint:: PrimitiveType Jint; Tlong :: PrimitiveType Jlong; Tfloat :: PrimitiveType Jfloat; Tdouble :: PrimitiveType Jdouble; }; instance Witness PrimitiveType where { withWitness f t@Tboolean = f t; withWitness f t@Tbyte = f t; withWitness f t@Tchar = f t; withWitness f t@Tshort = f t; withWitness f t@Tint = f t; withWitness f t@Tlong = f t; withWitness f t@Tfloat = f t; withWitness f t@Tdouble = f t; }; instance TotalWitness PrimitiveType where { matchWitnessF Tboolean Tboolean = Just id; matchWitnessF Tbyte Tbyte = Just id; matchWitnessF Tchar Tchar = Just id; matchWitnessF Tshort Tshort = Just id; matchWitnessF Tint Tint = Just id; matchWitnessF Tlong Tlong = Just id; matchWitnessF Tfloat Tfloat = Just id; matchWitnessF Tdouble Tdouble = Just id; matchWitnessF _ _ = Nothing; }; instance Is PrimitiveType Jboolean where { witness = Tboolean; }; instance Is PrimitiveType Jbyte where { witness = Tbyte; }; instance Is PrimitiveType Jchar where { witness = Tchar; }; instance Is PrimitiveType Jshort where { witness = Tshort; }; instance Is PrimitiveType Jint where { witness = Tint; }; instance Is PrimitiveType Jlong where { witness = Tlong; }; instance Is PrimitiveType Jfloat where { witness = Tfloat; }; instance Is PrimitiveType Jdouble where { witness = Tdouble; }; }